Skip to content

Commit

Permalink
Run build, tests in Java 17 (gwtproject#9830)
Browse files Browse the repository at this point in the history
With Javadoc now able to run on Java 17, we can make Java 17 the default
going forward for builds. This patch enables running tests in 17, and
fixes a few gotchas discovered - an old asm jar was being used for
tests, and when we updated to the latest asm for GWT 2.10, we didn't
update ClassVisitors to use the newer version.
  • Loading branch information
niloc132 authored Jun 10, 2023
1 parent 4f49137 commit 0e61ca3
Show file tree
Hide file tree
Showing 20 changed files with 44 additions and 43 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/full-check.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Run all tests and builds all aspects of GWT using Java 8 and 11. Runs nightly
# (plus or minus timzeones) on the main branch, and will also run right away on
# a push to a release branch. Release zips are uploaded as part of the build,
# though maven snapshots are not yet deployed.
# Run all tests and builds all aspects of GWT using Java 8, 11, and 17. Runs
# nightly (plus or minus timzeones) on the main branch, and will also run right
# away on a push to a release branch. Release zips are uploaded as part of the
# build, though maven snapshots are not yet deployed.
name: Full build
on:
schedule:
Expand All @@ -20,7 +20,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
java-version: [ '8', '11' ]
java-version: [ '8', '11', '17' ]
steps:
- name: Checkout GWT itself into one directory
uses: actions/checkout@v2
Expand Down Expand Up @@ -83,7 +83,7 @@ jobs:
- name: Set up sonatype credentials
# Using the same java version as above, set up a settings.xml file
uses: actions/setup-java@v3
if: ${{ github.event_name == 'schedule' && github.repository_owner == 'gwtproject' && matrix.java-version == '11' }}
if: ${{ github.event_name == 'schedule' && github.repository_owner == 'gwtproject' && matrix.java-version == '17' }}
with:
java-version: ${{ matrix.java-version }}
distribution: 'temurin'
Expand All @@ -93,7 +93,7 @@ jobs:
server-password: SONATYPE_PASSWORD

- name: Nightly builds should be deployed as snapshots to sonatype
if: ${{ github.event_name == 'schedule' && github.repository_owner == 'gwtproject' && matrix.java-version == '11' }}
if: ${{ github.event_name == 'schedule' && github.repository_owner == 'gwtproject' && matrix.java-version == '17' }}
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/quick-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
java-version: ['8', '11']
java-version: ['8', '11', '17']
steps:
- name: Checkout GWT itself into one directory
uses: actions/checkout@v2
Expand All @@ -22,7 +22,7 @@ jobs:
repository: 'gwtproject/tools'
path: 'tools'
- name: Set up JDK ${{ matrix.java-version }}
# GWT presently requires Java8 to build just the SDK and some tests, or 11 to build everything, but can run on newer Java versions
# GWT presently requires Java8 to build just the SDK and some tests, or 11+ to build everything, and can run on newer Java versions
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java-version }}
Expand All @@ -44,8 +44,8 @@ jobs:
ANT_OPTS=-Xmx2g
ant clean dist doc checkstyle apicheck
- name: Create pull request comments/annotations for checkstyle from the java 11 build, even on failure
if: ${{ always() && github.event_name == 'pull_request' && matrix.java-version == '11' }}
- name: Create pull request comments/annotations for checkstyle from the java 17 build, even on failure
if: ${{ always() && github.event_name == 'pull_request' && matrix.java-version == '17' }}
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
Expand All @@ -58,7 +58,7 @@ jobs:
done
- name: Upload checkstyle xml for manual review
uses: actions/upload-artifact@v2
if: ${{ matrix.java-version == '11' }}
if: ${{ matrix.java-version == '17' }}
with:
name: checkstyle-reports-java${{ matrix.java-version }}
path: 'gwt/build/out/**/checkstyle*.xml'
Expand Down
1 change: 1 addition & 0 deletions common.ant.xml
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@
<jvmarg value="-Demma.coverage.out.merge=true"/>
<jvmarg value="-Dcom.google.gwt.junit.reportPath=reports"/>
<jvmarg line="@{test.jvmargs}"/>
<jvmarg line="--add-opens=java.base/java.lang=ALL-UNNAMED" unless:true="${isJava8}"/>
<sysproperty key="gwt.args" value="@{test.args}"/>
<sysproperty key="java.awt.headless" value="true"/>
<classpath>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ private static class CompileDependencyVisitor extends ClassVisitor {
private Map<String, String> methods = new HashMap<String, String>();

public CompileDependencyVisitor() {
super(Opcodes.ASM7);
super(Opcodes.ASM9);
}

public String getSignature() {
Expand Down
2 changes: 1 addition & 1 deletion dev/core/src/com/google/gwt/dev/javac/CompilationUnit.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ private static class AnonymousClassVisitor extends EmptyVisitor {

public AnonymousClassVisitor() {

this.mv = new org.objectweb.asm.MethodVisitor(Opcodes.ASM7, this.mv) {
this.mv = new org.objectweb.asm.MethodVisitor(Opcodes.ASM9, this.mv) {
@Override
public void visitCode() {
++sawCode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public static class MyAnnotationArrayVisitor extends AnnotationVisitor {
private final List<Object> values = new ArrayList<Object>();

public MyAnnotationArrayVisitor(Callback<Object> callback) {
super(Opcodes.ASM7);
super(Opcodes.ASM9);
this.callback = callback;
}

Expand Down Expand Up @@ -158,7 +158,7 @@ public CollectAnnotationData(String desc, boolean visible) {
*/
CollectAnnotationData(String desc, boolean visible,
Callback<CollectAnnotationData.AnnotationData> callback) {
super(Opcodes.ASM7);
super(Opcodes.ASM9);
annotation = new AnnotationData(desc, visible);
this.callback = callback;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class CollectFieldData extends FieldVisitor {

public CollectFieldData(int access, String name, String desc,
String signature, Object value) {
super(Opcodes.ASM7);
super(Opcodes.ASM9);
this.access = access;
this.name = name;
this.desc = desc;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public class CollectMethodData extends MethodVisitor {
// for new List[]
public CollectMethodData(CollectClassData.ClassType classType, int access,
String name, String desc, String signature, String[] exceptions) {
super(Opcodes.ASM7);
super(Opcodes.ASM9);
this.access = access;
this.name = name;
this.desc = desc;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class CollectReferencesVisitor extends EmptyVisitor {
private class CollectGenericTypes extends SignatureVisitor {

public CollectGenericTypes() {
super(Opcodes.ASM7);
super(Opcodes.ASM9);
}

@Override
Expand Down Expand Up @@ -121,7 +121,7 @@ public void visitTypeVariable(String name) {
}

CollectReferencesVisitor() {
this.av = new AnnotationVisitor(Opcodes.ASM7, this.av) {
this.av = new AnnotationVisitor(Opcodes.ASM9, this.av) {
@Override
public void visitEnum(String name, String desc, String value) {
addTypeIfClass(desc);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class EmptySignatureVisitor extends SignatureVisitor {
protected static EmptySignatureVisitor ignore = new EmptySignatureVisitor();

public EmptySignatureVisitor() {
super(Opcodes.ASM7);
super(Opcodes.ASM9);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
*/
public class EmptyVisitor extends ClassVisitor {

protected AnnotationVisitor av = new AnnotationVisitor(Opcodes.ASM7) {
protected AnnotationVisitor av = new AnnotationVisitor(Opcodes.ASM9) {

@Override
public AnnotationVisitor visitAnnotation(String name, String desc) {
Expand All @@ -41,10 +41,10 @@ public AnnotationVisitor visitArray(String name) {
};

public EmptyVisitor() {
super(Opcodes.ASM7);
super(Opcodes.ASM9);
}

protected MethodVisitor mv = new MethodVisitor(Opcodes.ASM7) {
protected MethodVisitor mv = new MethodVisitor(Opcodes.ASM9) {

@Override
public AnnotationVisitor visitAnnotationDefault() {
Expand All @@ -63,7 +63,7 @@ public AnnotationVisitor visitParameterAnnotation(
}
};

protected FieldVisitor fv = new FieldVisitor(Opcodes.ASM7) {
protected FieldVisitor fv = new FieldVisitor(Opcodes.ASM9) {

@Override
public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
class ForceClassVersion15 extends ClassVisitor {

public ForceClassVersion15(ClassVisitor v) {
super(Opcodes.ASM7, v);
super(Opcodes.ASM9, v);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public static boolean hasAnnotation(byte[] classBytes,
private final String targetDesc;

public HasAnnotation(ClassVisitor v, Class<? extends Annotation> annotation) {
super(Opcodes.ASM7, v);
super(Opcodes.ASM9, v);
targetDesc = Type.getDescriptor(annotation);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ private class MyMethodAdapter extends GeneratorAdapter {

public MyMethodAdapter(MethodVisitor mv, int access, String name,
String desc) {
super(Opcodes.ASM7, mv, access, name, desc);
super(Opcodes.ASM9, mv, access, name, desc);
this.descriptor = desc;
this.name = name;
isStatic = (access & Opcodes.ACC_STATIC) != 0;
Expand Down Expand Up @@ -329,7 +329,7 @@ private void loadClassArray() {

public RewriteJsniMethods(ClassVisitor v,
Map<String, String> anonymousClassMap) {
super(Opcodes.ASM7, v);
super(Opcodes.ASM9, v);
this.anonymousClassMap = anonymousClassMap;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public String map(String typeName) {
};

public MyMethodAdapter(MethodVisitor mv) {
super(Opcodes.ASM7, mv);
super(Opcodes.ASM9, mv);
}

@Override
Expand Down Expand Up @@ -132,7 +132,7 @@ public void visitTypeInsn(int opcode, String type) {
*/
public RewriteRefsToJsoClasses(ClassVisitor cv, Set<String> jsoDescriptors,
InstanceMethodOracle mapper) {
super(Opcodes.ASM7, cv);
super(Opcodes.ASM9, cv);
this.jsoDescriptors = jsoDescriptors;
this.mapper = mapper;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
public class RewriteSingleJsoImplDispatches extends ClassVisitor {
private class MyMethodVisitor extends MethodVisitor {
public MyMethodVisitor(MethodVisitor mv) {
super(Opcodes.ASM7, mv);
super(Opcodes.ASM9, mv);
}

/*
Expand Down Expand Up @@ -133,7 +133,7 @@ public void visitMethodInsn(int opcode, String owner, String name,

public RewriteSingleJsoImplDispatches(ClassVisitor v, TypeOracle typeOracle,
SingleJsoImplData jsoData) {
super(Opcodes.ASM7, v);
super(Opcodes.ASM9, v);
this.typeOracle = typeOracle;
this.jsoData = jsoData;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ private static class MethodInterceptor extends MethodVisitor {
private String className;

protected MethodInterceptor(MethodVisitor mv, String className) {
super(Opcodes.ASM7, mv);
super(Opcodes.ASM9, mv);
this.className = className;
}

Expand Down Expand Up @@ -144,7 +144,7 @@ public void visitMethodInsn(int opcode, String owner, String name,
private String className;

public UseMirroredClasses(ClassVisitor cv, String className) {
super(Opcodes.ASM7, cv);
super(Opcodes.ASM9, cv);
this.className = className;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ public static ClassVisitor create(ClassVisitor cv, String classDescriptor,
* @param mapper maps methods to the class in which they are declared
*/
private WriteJsoImpl(ClassVisitor cv, InstanceMethodOracle mapper) {
super(Opcodes.ASM7, cv);
super(Opcodes.ASM9, cv);
this.mapper = mapper;
}

Expand Down
4 changes: 2 additions & 2 deletions user/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@
<pathelement location="${gwt.tools.lib}/cglib/cglib-3.1.jar"/>
<pathelement location="${gwt.tools.lib}/mockito/1.9.5/mockito-all-1.9.5.jar"/>
<pathelement location="${gwt.tools.lib}/objenesis/objenesis-1.2.jar"/>
<pathelement location="${gwt.tools.lib}/objectweb/asm-7.1/asm-7.1.jar"/>
<pathelement location="${gwt.tools.lib}/objectweb/asm-7.1/asm-commons-7.1.jar"/>
<pathelement location="${gwt.tools.lib}/objectweb/asm-9.2/asm-9.2.jar"/>
<pathelement location="${gwt.tools.lib}/objectweb/asm-9.2/asm-commons-9.2.jar"/>
<pathelement location="${gwt.tools.lib}/javax/validation/validation-api-1.0.0.GA.jar"/>
<pathelement location="${gwt.tools.lib}/javax/validation/validation-api-1.0.0.GA-sources.jar"/>
<pathelement
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ private class AnnotationProcessor extends AnnotationVisitor {

public AnnotationProcessor(String sourceType, AnnotationVisitor av) {
// TODO(rluble): should we chain av to super here?
super(Opcodes.ASM7);
super(Opcodes.ASM9);
this.sourceType = sourceType;
this.av = av;
}
Expand Down Expand Up @@ -386,7 +386,7 @@ private class ClassProcessor extends ClassVisitor {
private String sourceType;

public ClassProcessor(String sourceType, ClassVisitor cv, State state) {
super(Opcodes.ASM7, cv);
super(Opcodes.ASM9, cv);
this.sourceType = sourceType;
this.state = state;
}
Expand Down Expand Up @@ -519,7 +519,7 @@ private class FieldProcessor extends FieldVisitor {

public FieldProcessor(String sourceType, FieldVisitor fv) {
// TODO(rluble): Should we chain fv to super here?
super(Opcodes.ASM7);
super(Opcodes.ASM9);
this.sourceType = sourceType;
this.fv = fv;
}
Expand All @@ -541,7 +541,7 @@ private class MethodProcessor extends MethodVisitor {
private final String sourceType;

public MethodProcessor(String sourceType, MethodVisitor mv) {
super(Opcodes.ASM7, mv);
super(Opcodes.ASM9, mv);
this.sourceType = sourceType;
}

Expand Down Expand Up @@ -630,7 +630,7 @@ public void visitTypeInsn(int opcode, String type) {
*/
private class NativeMethodDefanger extends ClassVisitor {
public NativeMethodDefanger(ClassVisitor cv) {
super(Opcodes.ASM7, cv);
super(Opcodes.ASM9, cv);
}

@Override
Expand Down

0 comments on commit 0e61ca3

Please sign in to comment.