Skip to content

Commit

Permalink
Revert "Upgrade to Eclipse 2021-09"
Browse files Browse the repository at this point in the history
This reverts commit f57832d.

See gh-277
  • Loading branch information
wilkinsona committed Sep 24, 2021
1 parent f57832d commit dad5fec
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 20 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@
<main.basedir>${basedir}</main.basedir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<eclipse.repository>https://download.eclipse.org/releases/2021-09/202109151000/</eclipse.repository>
<eclipse.repository>https://download.eclipse.org/releases/2021-03/202103171000/</eclipse.repository>
<eclipse.checkstyle.repository>https://checkstyle.org/eclipse-cs-update-site/</eclipse.checkstyle.repository>
<tycho.disableP2Mirrors>true</tycho.disableP2Mirrors>
<ant.version>1.8.1</ant.version>
<ant-contrib.version>1.0b3</ant-contrib.version>
<asm.version>7.3.1</asm.version>
<asm.version>5.2</asm.version>
<assertj.version>3.8.0</assertj.version>
<checkstyle.version>8.45.1</checkstyle.version>
<gradle.version>3.4</gradle.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
* Internal build utility used to rewrite eclipse runtime classes.
*
* @author Phillip Webb
* @author Andy Wilkinson
*/
public final class EclipseRewriter {

Expand Down Expand Up @@ -76,7 +75,7 @@ public void rewrite(String file) throws IOException {
private void rewrite(FileSystem zip) throws IOException {
rewrite(zip, "org/eclipse/jdt/internal/formatter/DefaultCodeFormatter.class",
DefaultCodeFormatterManipulator::new);
rewrite(zip, "org/eclipse/osgi/util/NLS.class", NlsManipulator::new);
rewrite(zip, "org/eclipse/osgi/util/NLS$1.class", NlsManipulator::new);
}

private void rewrite(FileSystem zip, String name, Function<ClassWriter, ClassVisitor> manipulator)
Expand All @@ -101,7 +100,7 @@ public static void main(String[] args) throws Exception {
private static class DefaultCodeFormatterManipulator extends ClassVisitor {

DefaultCodeFormatterManipulator(ClassVisitor visitor) {
super(Opcodes.ASM7, visitor);
super(Opcodes.ASM5, visitor);
}

@Override
Expand Down Expand Up @@ -130,7 +129,7 @@ public MethodVisitor visitMethod(int access, String name, String desc, String si
private static class DefaultCodeFormatterMethodManipulator extends MethodVisitor {

DefaultCodeFormatterMethodManipulator(MethodVisitor mv) {
super(Opcodes.ASM7, mv);
super(Opcodes.ASM5, mv);
}

@Override
Expand All @@ -150,12 +149,12 @@ public void visitMethodInsn(int opcode, String owner, String name, String desc,
private static class NlsManipulator extends ClassVisitor {

NlsManipulator(ClassVisitor visitor) {
super(Opcodes.ASM7, visitor);
super(Opcodes.ASM5, visitor);
}

@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
if ("<clinit>".equals(name)) {
if ("run".equals(name) && desc.contains("Boolean")) {
return new NslMethodManipulator(super.visitMethod(access, name, desc, signature, exceptions));
}
return super.visitMethod(access, name, desc, signature, exceptions);
Expand All @@ -172,26 +171,17 @@ private static class NslMethodManipulator extends MethodVisitor {
private final MethodVisitor methodVisitor;

NslMethodManipulator(MethodVisitor mv) {
super(Opcodes.ASM7, null);
super(Opcodes.ASM5, null);
this.methodVisitor = mv;
}

@Override
public void visitEnd() {
MethodVisitor mv = this.methodVisitor;
mv.visitCode();
mv.visitInsn(Opcodes.ICONST_0);
mv.visitTypeInsn(Opcodes.ANEWARRAY, "java/lang/Object");
mv.visitFieldInsn(Opcodes.PUTSTATIC, "org/eclipse/osgi/util/NLS", "EMPTY_ARGS", "[Ljava/lang/Object;");
mv.visitFieldInsn(Opcodes.GETSTATIC, "java/lang/Boolean", "TRUE", "Ljava/lang/Boolean;");
mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "java/lang/Boolean", "booleanValue", "()Z", false);
mv.visitFieldInsn(Opcodes.PUTSTATIC, "org/eclipse/osgi/util/NLS", "ignoreWarnings", "Z");
mv.visitTypeInsn(Opcodes.NEW, "java/lang/Object");
mv.visitInsn(Opcodes.DUP);
mv.visitMethodInsn(Opcodes.INVOKESPECIAL, "java/lang/Object", "<init>", "()V", false);
mv.visitFieldInsn(Opcodes.PUTSTATIC, "org/eclipse/osgi/util/NLS", "ASSIGNED", "Ljava/lang/Object;");
mv.visitInsn(Opcodes.RETURN);
mv.visitMaxs(2, 0);
mv.visitInsn(Opcodes.ARETURN);
mv.visitMaxs(1, 1);
mv.visitEnd();
}

Expand Down

0 comments on commit dad5fec

Please sign in to comment.