diff --git a/.github/workflows/full-check.yml b/.github/workflows/full-check.yml index 3e3cd612901..7d179f33859 100644 --- a/.github/workflows/full-check.yml +++ b/.github/workflows/full-check.yml @@ -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: @@ -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 @@ -84,7 +84,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' @@ -94,7 +94,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 }} diff --git a/.github/workflows/quick-check.yml b/.github/workflows/quick-check.yml index 02d69d9c859..7deb3ed5582 100644 --- a/.github/workflows/quick-check.yml +++ b/.github/workflows/quick-check.yml @@ -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 @@ -23,7 +23,7 @@ jobs: path: 'tools' ref: '9727-jakarta-servlet-support' - 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 }} @@ -45,8 +45,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: | @@ -59,7 +59,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' diff --git a/README.md b/README.md index a91c49ce934..9eb5d06ec35 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,8 @@ - To compile everything including examples you have to run `$ ant clean dist` + + - To create maven artifacts (after building .jar using ant), use [following guide](./maven/README.txt). ### How to verify GWT code conventions: diff --git a/build_tools/doctool/src/com/google/doctool/custom/JavaEmulSummaryDoclet.java b/build_tools/doctool/src/com/google/doctool/custom/JavaEmulSummaryDoclet.java index 81a487e1e8e..1b8a5ce21be 100644 --- a/build_tools/doctool/src/com/google/doctool/custom/JavaEmulSummaryDoclet.java +++ b/build_tools/doctool/src/com/google/doctool/custom/JavaEmulSummaryDoclet.java @@ -53,7 +53,7 @@ public class JavaEmulSummaryDoclet implements Doclet { public static final String OPT_OUTFILE = "-outfile"; - private static final String JAVADOC_URL = "https://docs.oracle.com/javase/8/docs/api/"; + private static final String JAVADOC_URL = "https://docs.oracle.com/en/java/javase/11/docs/api/"; private Reporter reporter; private String outputFile; diff --git a/common.ant.xml b/common.ant.xml index 164472ffb63..7b3604ba603 100755 --- a/common.ant.xml +++ b/common.ant.xml @@ -251,6 +251,7 @@ + diff --git a/dev/core/src/com/google/gwt/dev/javac/BytecodeSignatureMaker.java b/dev/core/src/com/google/gwt/dev/javac/BytecodeSignatureMaker.java index 762c4228ed8..a70120930ba 100644 --- a/dev/core/src/com/google/gwt/dev/javac/BytecodeSignatureMaker.java +++ b/dev/core/src/com/google/gwt/dev/javac/BytecodeSignatureMaker.java @@ -56,7 +56,7 @@ private static class CompileDependencyVisitor extends ClassVisitor { private Map methods = new HashMap(); public CompileDependencyVisitor() { - super(Opcodes.ASM7); + super(Opcodes.ASM9); } public String getSignature() { diff --git a/dev/core/src/com/google/gwt/dev/javac/CompilationUnit.java b/dev/core/src/com/google/gwt/dev/javac/CompilationUnit.java index 6f7f003dc0d..0066c2f7628 100644 --- a/dev/core/src/com/google/gwt/dev/javac/CompilationUnit.java +++ b/dev/core/src/com/google/gwt/dev/javac/CompilationUnit.java @@ -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; diff --git a/dev/core/src/com/google/gwt/dev/javac/asm/CollectAnnotationData.java b/dev/core/src/com/google/gwt/dev/javac/asm/CollectAnnotationData.java index 95fcc52fc0b..2d26d19d577 100644 --- a/dev/core/src/com/google/gwt/dev/javac/asm/CollectAnnotationData.java +++ b/dev/core/src/com/google/gwt/dev/javac/asm/CollectAnnotationData.java @@ -79,7 +79,7 @@ public static class MyAnnotationArrayVisitor extends AnnotationVisitor { private final List values = new ArrayList(); public MyAnnotationArrayVisitor(Callback callback) { - super(Opcodes.ASM7); + super(Opcodes.ASM9); this.callback = callback; } @@ -158,7 +158,7 @@ public CollectAnnotationData(String desc, boolean visible) { */ CollectAnnotationData(String desc, boolean visible, Callback callback) { - super(Opcodes.ASM7); + super(Opcodes.ASM9); annotation = new AnnotationData(desc, visible); this.callback = callback; } diff --git a/dev/core/src/com/google/gwt/dev/javac/asm/CollectFieldData.java b/dev/core/src/com/google/gwt/dev/javac/asm/CollectFieldData.java index 3bfb4348559..234e2865b70 100644 --- a/dev/core/src/com/google/gwt/dev/javac/asm/CollectFieldData.java +++ b/dev/core/src/com/google/gwt/dev/javac/asm/CollectFieldData.java @@ -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; diff --git a/dev/core/src/com/google/gwt/dev/javac/asm/CollectMethodData.java b/dev/core/src/com/google/gwt/dev/javac/asm/CollectMethodData.java index 95f17a411fa..c4af9901f93 100644 --- a/dev/core/src/com/google/gwt/dev/javac/asm/CollectMethodData.java +++ b/dev/core/src/com/google/gwt/dev/javac/asm/CollectMethodData.java @@ -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; diff --git a/dev/core/src/com/google/gwt/dev/javac/asm/CollectReferencesVisitor.java b/dev/core/src/com/google/gwt/dev/javac/asm/CollectReferencesVisitor.java index 17b32939782..773a4073933 100644 --- a/dev/core/src/com/google/gwt/dev/javac/asm/CollectReferencesVisitor.java +++ b/dev/core/src/com/google/gwt/dev/javac/asm/CollectReferencesVisitor.java @@ -42,7 +42,7 @@ public class CollectReferencesVisitor extends EmptyVisitor { private class CollectGenericTypes extends SignatureVisitor { public CollectGenericTypes() { - super(Opcodes.ASM7); + super(Opcodes.ASM9); } @Override @@ -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); diff --git a/dev/core/src/com/google/gwt/dev/javac/asm/EmptySignatureVisitor.java b/dev/core/src/com/google/gwt/dev/javac/asm/EmptySignatureVisitor.java index fe5385711ec..df82c2a2608 100644 --- a/dev/core/src/com/google/gwt/dev/javac/asm/EmptySignatureVisitor.java +++ b/dev/core/src/com/google/gwt/dev/javac/asm/EmptySignatureVisitor.java @@ -34,7 +34,7 @@ public class EmptySignatureVisitor extends SignatureVisitor { protected static EmptySignatureVisitor ignore = new EmptySignatureVisitor(); public EmptySignatureVisitor() { - super(Opcodes.ASM7); + super(Opcodes.ASM9); } /** diff --git a/dev/core/src/com/google/gwt/dev/javac/asmbridge/EmptyVisitor.java b/dev/core/src/com/google/gwt/dev/javac/asmbridge/EmptyVisitor.java index ffa3ba4b9f9..7585c7def0b 100644 --- a/dev/core/src/com/google/gwt/dev/javac/asmbridge/EmptyVisitor.java +++ b/dev/core/src/com/google/gwt/dev/javac/asmbridge/EmptyVisitor.java @@ -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) { @@ -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() { @@ -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) { diff --git a/dev/core/src/com/google/gwt/dev/shell/rewrite/ForceClassVersion15.java b/dev/core/src/com/google/gwt/dev/shell/rewrite/ForceClassVersion15.java index 52c5e7517f7..2f175877de7 100644 --- a/dev/core/src/com/google/gwt/dev/shell/rewrite/ForceClassVersion15.java +++ b/dev/core/src/com/google/gwt/dev/shell/rewrite/ForceClassVersion15.java @@ -25,7 +25,7 @@ class ForceClassVersion15 extends ClassVisitor { public ForceClassVersion15(ClassVisitor v) { - super(Opcodes.ASM7, v); + super(Opcodes.ASM9, v); } @Override diff --git a/dev/core/src/com/google/gwt/dev/shell/rewrite/HasAnnotation.java b/dev/core/src/com/google/gwt/dev/shell/rewrite/HasAnnotation.java index 15f0d1586b2..6b7d18fdbb6 100644 --- a/dev/core/src/com/google/gwt/dev/shell/rewrite/HasAnnotation.java +++ b/dev/core/src/com/google/gwt/dev/shell/rewrite/HasAnnotation.java @@ -54,7 +54,7 @@ public static boolean hasAnnotation(byte[] classBytes, private final String targetDesc; public HasAnnotation(ClassVisitor v, Class annotation) { - super(Opcodes.ASM7, v); + super(Opcodes.ASM9, v); targetDesc = Type.getDescriptor(annotation); } diff --git a/dev/core/src/com/google/gwt/dev/shell/rewrite/RewriteJsniMethods.java b/dev/core/src/com/google/gwt/dev/shell/rewrite/RewriteJsniMethods.java index 6ce96eb0a17..29b801593a4 100644 --- a/dev/core/src/com/google/gwt/dev/shell/rewrite/RewriteJsniMethods.java +++ b/dev/core/src/com/google/gwt/dev/shell/rewrite/RewriteJsniMethods.java @@ -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; @@ -329,7 +329,7 @@ private void loadClassArray() { public RewriteJsniMethods(ClassVisitor v, Map anonymousClassMap) { - super(Opcodes.ASM7, v); + super(Opcodes.ASM9, v); this.anonymousClassMap = anonymousClassMap; } diff --git a/dev/core/src/com/google/gwt/dev/shell/rewrite/RewriteRefsToJsoClasses.java b/dev/core/src/com/google/gwt/dev/shell/rewrite/RewriteRefsToJsoClasses.java index 1911d517dcd..6ddf8241ca9 100644 --- a/dev/core/src/com/google/gwt/dev/shell/rewrite/RewriteRefsToJsoClasses.java +++ b/dev/core/src/com/google/gwt/dev/shell/rewrite/RewriteRefsToJsoClasses.java @@ -54,7 +54,7 @@ public String map(String typeName) { }; public MyMethodAdapter(MethodVisitor mv) { - super(Opcodes.ASM7, mv); + super(Opcodes.ASM9, mv); } @Override @@ -132,7 +132,7 @@ public void visitTypeInsn(int opcode, String type) { */ public RewriteRefsToJsoClasses(ClassVisitor cv, Set jsoDescriptors, InstanceMethodOracle mapper) { - super(Opcodes.ASM7, cv); + super(Opcodes.ASM9, cv); this.jsoDescriptors = jsoDescriptors; this.mapper = mapper; } diff --git a/dev/core/src/com/google/gwt/dev/shell/rewrite/RewriteSingleJsoImplDispatches.java b/dev/core/src/com/google/gwt/dev/shell/rewrite/RewriteSingleJsoImplDispatches.java index ff38213b8d8..cd7eb1cf672 100644 --- a/dev/core/src/com/google/gwt/dev/shell/rewrite/RewriteSingleJsoImplDispatches.java +++ b/dev/core/src/com/google/gwt/dev/shell/rewrite/RewriteSingleJsoImplDispatches.java @@ -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); } /* @@ -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; } diff --git a/dev/core/src/com/google/gwt/dev/shell/rewrite/UseMirroredClasses.java b/dev/core/src/com/google/gwt/dev/shell/rewrite/UseMirroredClasses.java index 51ac42d387b..4ddbe63a52e 100644 --- a/dev/core/src/com/google/gwt/dev/shell/rewrite/UseMirroredClasses.java +++ b/dev/core/src/com/google/gwt/dev/shell/rewrite/UseMirroredClasses.java @@ -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; } @@ -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; } diff --git a/dev/core/src/com/google/gwt/dev/shell/rewrite/WriteJsoImpl.java b/dev/core/src/com/google/gwt/dev/shell/rewrite/WriteJsoImpl.java index 8d460737ced..29956a17f04 100644 --- a/dev/core/src/com/google/gwt/dev/shell/rewrite/WriteJsoImpl.java +++ b/dev/core/src/com/google/gwt/dev/shell/rewrite/WriteJsoImpl.java @@ -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; } diff --git a/dev/core/test/com/google/gwt/dev/MinimalRebuildCacheManagerTest.java b/dev/core/test/com/google/gwt/dev/MinimalRebuildCacheManagerTest.java index 11aae8bdedf..420d3da3608 100644 --- a/dev/core/test/com/google/gwt/dev/MinimalRebuildCacheManagerTest.java +++ b/dev/core/test/com/google/gwt/dev/MinimalRebuildCacheManagerTest.java @@ -18,11 +18,14 @@ import com.google.gwt.dev.jjs.ast.JTypeOracle; import com.google.gwt.thirdparty.guava.common.collect.ImmutableMap; import com.google.gwt.thirdparty.guava.common.collect.Sets; -import com.google.gwt.thirdparty.guava.common.io.Files; import junit.framework.TestCase; -import java.io.File; +import org.apache.commons.io.FileUtils; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; import java.util.Map; /** @@ -30,15 +33,15 @@ */ public class MinimalRebuildCacheManagerTest extends TestCase { - public void testCacheChange() throws InterruptedException { + public void testCacheChange() throws InterruptedException, IOException { String moduleName = "com.google.FooModule"; Map initialCompilerOptions = ImmutableMap.of("option", "oldvalue"); PermutationDescription permutationDescription = new PermutationDescription(); - File cacheDir = Files.createTempDir(); + Path cacheDir = Files.createTempDirectory(null); MinimalRebuildCacheManager minimalRebuildCacheManager = new MinimalRebuildCacheManager( - TreeLogger.NULL, cacheDir, initialCompilerOptions); + TreeLogger.NULL, cacheDir.toFile(), initialCompilerOptions); // Make sure we start with a blank slate. minimalRebuildCacheManager.deleteCaches(); @@ -65,7 +68,7 @@ public void testCacheChange() throws InterruptedException { Map newCompilerOptions = ImmutableMap.of("option", "newvalue"); minimalRebuildCacheManager = new MinimalRebuildCacheManager( - TreeLogger.NULL, cacheDir, newCompilerOptions); + TreeLogger.NULL, cacheDir.toFile(), newCompilerOptions); // Now get the cache for FooModule under different compiler flags MinimalRebuildCache fooCacheNew = minimalRebuildCacheManager.getCache(moduleName, @@ -84,7 +87,7 @@ public void testCacheChange() throws InterruptedException { // Switch back to the initial option values and verify you get the same old cache. minimalRebuildCacheManager = new MinimalRebuildCacheManager( - TreeLogger.NULL, cacheDir, initialCompilerOptions); + TreeLogger.NULL, cacheDir.toFile(), initialCompilerOptions); // Now get the cache for FooModule under different under initial options values. MinimalRebuildCache fooCacheResetOptions = minimalRebuildCacheManager.getCache( @@ -96,16 +99,16 @@ public void testCacheChange() throws InterruptedException { assertTrue(fooCacheOld.hasSameContent(fooCacheResetOptions)); minimalRebuildCacheManager.deleteCaches(); minimalRebuildCacheManager.shutdown(); - cacheDir.delete(); + FileUtils.deleteDirectory(cacheDir.toFile()); } - public void testReload() throws InterruptedException { - File cacheDir = Files.createTempDir(); + public void testReload() throws InterruptedException, IOException { + Path cacheDir = Files.createTempDirectory(null); String moduleName = "com.google.FooModule"; MinimalRebuildCacheManager minimalRebuildCacheManager = new MinimalRebuildCacheManager( - TreeLogger.NULL, cacheDir, ImmutableMap.of()); + TreeLogger.NULL, cacheDir.toFile(), ImmutableMap.of()); PermutationDescription permutationDescription = new PermutationDescription(); // Make sure we start with a blank slate. @@ -149,7 +152,7 @@ public void testReload() throws InterruptedException { // Start a new cache manager in the same folder. MinimalRebuildCacheManager reloadedMinimalRebuildCacheManager = new MinimalRebuildCacheManager( - TreeLogger.NULL, cacheDir, ImmutableMap.of()); + TreeLogger.NULL, cacheDir.toFile(), ImmutableMap.of()); // Reread the previously saved cache. MinimalRebuildCache reloadedCache = diff --git a/dev/core/test/com/google/gwt/dev/resource/impl/ClassPathEntryTest.java b/dev/core/test/com/google/gwt/dev/resource/impl/ClassPathEntryTest.java index 3843f2394df..382df33b24d 100644 --- a/dev/core/test/com/google/gwt/dev/resource/impl/ClassPathEntryTest.java +++ b/dev/core/test/com/google/gwt/dev/resource/impl/ClassPathEntryTest.java @@ -17,12 +17,13 @@ import com.google.gwt.core.ext.TreeLogger; import com.google.gwt.thirdparty.guava.common.collect.Lists; -import com.google.gwt.thirdparty.guava.common.io.Files; -import java.io.File; import java.io.IOException; import java.lang.ref.WeakReference; import java.net.URISyntaxException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.attribute.DosFileAttributeView; import java.util.Collection; import java.util.Map; import java.util.Set; @@ -32,21 +33,22 @@ */ public class ClassPathEntryTest extends AbstractResourceOrientedTestBase { - /** - * This test will likely not work on Windows since directories that start with . are not - * implicitly hidden there. But since Java 6 does not have a File.setHidden() function, fixing - * this test for Windows is deferred till GWT officially depends on Java 7. - */ public void testIgnoresHiddenDirectories() throws IOException { // Setup a /tmp/.svn/ShouldNotBeFound.java folder structure. - File tempDir = Files.createTempDir(); - File nestedHiddenDir = new File(tempDir, ".svn"); - nestedHiddenDir.mkdir(); - File javaFile = new File(nestedHiddenDir, "ShouldNotBeFound.java"); - javaFile.createNewFile(); + Path tempDir = Files.createTempDirectory(null); + Path nestedHiddenDir = tempDir.resolve(".svn"); + Files.createDirectory(nestedHiddenDir); + Path javaFile = nestedHiddenDir.resolve("ShouldNotBeFound.java"); + Files.createFile(javaFile); + // windows needs the hidden attribute to be set on file (not parent directory) + DosFileAttributeView hiddenAttr = Files.getFileAttributeView(javaFile, + DosFileAttributeView.class); + if (hiddenAttr != null) { + hiddenAttr.setHidden(true); + } // Perform a class path directory inspection. - DirectoryClassPathEntry cpe = new DirectoryClassPathEntry(tempDir); + DirectoryClassPathEntry cpe = new DirectoryClassPathEntry(tempDir.toFile()); Map resources = cpe.findApplicableResources(TreeLogger.NULL, createInclusivePathPrefixSet()); @@ -66,7 +68,7 @@ public void testResourceCreated() throws IOException, InterruptedException { public void testForResourceListenerLeaks_pathPrefixSetIsCollected() throws Exception { // Create a folder an initially empty folder. PathPrefixSet pathPrefixSet = createInclusivePathPrefixSet(); - DirectoryClassPathEntry classPathEntry = new DirectoryClassPathEntry(Files.createTempDir()); + DirectoryClassPathEntry classPathEntry = new DirectoryClassPathEntry(Files.createTempDirectory(null).toFile()); // Show that we are not listening. awaitFullGc(); @@ -94,7 +96,8 @@ public void testForResourceListenerLeaks_pathPrefixSetIsCollected() throws Excep public void testForResourceListenerLeaks_classPathEntryIsCollected() throws Exception { // Create a folder an initially empty folder. PathPrefixSet pathPrefixSet = createInclusivePathPrefixSet(); - DirectoryClassPathEntry classPathEntry = new DirectoryClassPathEntry(Files.createTempDir()); + DirectoryClassPathEntry classPathEntry = new DirectoryClassPathEntry( + Files.createTempDirectory(null).toFile()); // Show that we are not listening. awaitFullGc(); @@ -122,8 +125,8 @@ public void testForResourceListenerLeaks_classPathEntryIsCollected() throws Exce public void testResourceCreated(Collection pathPrefixSets) throws IOException, InterruptedException { // Create a folder an initially empty folder. - File tempDir = Files.createTempDir(); - DirectoryClassPathEntry cpe = new DirectoryClassPathEntry(tempDir); + Path tempDir = Files.createTempDirectory(null); + DirectoryClassPathEntry cpe = new DirectoryClassPathEntry(tempDir.toFile()); // Perform a class path directory inspection. for (PathPrefixSet pathPrefixSet : pathPrefixSets) { @@ -135,8 +138,8 @@ public void testResourceCreated(Collection pathPrefixSets) throws } // Create a file and give file events time to fire. - File createdFile = new File(tempDir, "Created.java"); - createdFile.createNewFile(); + Path createdFile = tempDir.resolve("Created.java"); + Files.createFile(createdFile); Thread.sleep(10); // Perform a class path directory inspection. @@ -161,10 +164,10 @@ public void testResourceDeleted() throws IOException, InterruptedException { private void testResourceDeleted(Collection pathPrefixSets) throws IOException, InterruptedException { // Create a folder with one initial file, that can be deleted. - File tempDir = Files.createTempDir(); - File fileToDelete = new File(tempDir, "ToDelete.java"); - fileToDelete.createNewFile(); - DirectoryClassPathEntry cpe = new DirectoryClassPathEntry(tempDir); + Path tempDir = Files.createTempDirectory(null); + Path fileToDelete = tempDir.resolve("ToDelete.java"); + Files.createFile(fileToDelete); + DirectoryClassPathEntry cpe = new DirectoryClassPathEntry(tempDir.toFile()); // Perform a class path directory inspection. for (PathPrefixSet pathPrefixSet : pathPrefixSets) { @@ -177,7 +180,7 @@ private void testResourceDeleted(Collection pathPrefixSets) throw } // Delete the file and give file events time to fire. - fileToDelete.delete(); + Files.delete(fileToDelete); Thread.sleep(10); // Perform a class path directory inspection. @@ -201,10 +204,10 @@ public void testResourceRenamed() throws IOException, InterruptedException { private void testResourceRenamed(Collection pathPrefixSets) throws IOException, InterruptedException { // Create a folder with one initial file, that can be renamed. - File tempDir = Files.createTempDir(); - File fileToRename = new File(tempDir, "ToRename.java"); - fileToRename.createNewFile(); - DirectoryClassPathEntry cpe = new DirectoryClassPathEntry(tempDir); + Path tempDir = Files.createTempDirectory(null); + Path fileToRename = tempDir.resolve("ToRename.java"); + Files.createFile(fileToRename); + DirectoryClassPathEntry cpe = new DirectoryClassPathEntry(tempDir.toFile()); // Perform class path directory inspections. for (PathPrefixSet pathPrefixSet : pathPrefixSets) { @@ -217,7 +220,7 @@ private void testResourceRenamed(Collection pathPrefixSets) throw } // Rename the file and give file events time to fire. - fileToRename.renameTo(new File(tempDir, "Renamed.java")); + Files.move(fileToRename, tempDir.resolve("Renamed.java")); Thread.sleep(10); for (PathPrefixSet pathPrefixSet : pathPrefixSets) { diff --git a/dev/core/test/com/google/gwt/dev/resource/impl/ResourceAccumulatorTest.java b/dev/core/test/com/google/gwt/dev/resource/impl/ResourceAccumulatorTest.java index ca5e3a9cd57..d61b8ba44fb 100644 --- a/dev/core/test/com/google/gwt/dev/resource/impl/ResourceAccumulatorTest.java +++ b/dev/core/test/com/google/gwt/dev/resource/impl/ResourceAccumulatorTest.java @@ -15,13 +15,15 @@ import com.google.gwt.thirdparty.guava.common.collect.Lists; import com.google.gwt.thirdparty.guava.common.collect.Sets; -import com.google.gwt.thirdparty.guava.common.io.Files; import junit.framework.TestCase; -import java.io.File; +import org.apache.commons.lang3.SystemUtils; + import java.io.IOException; import java.nio.file.FileSystemException; +import java.nio.file.Files; +import java.nio.file.Path; import java.util.Collections; import java.util.Comparator; import java.util.List; @@ -33,11 +35,11 @@ public class ResourceAccumulatorTest extends TestCase { public void testAddFile() throws Exception { - File rootDirectory = Files.createTempDir(); - File subDirectory = createDirectoryIn("subdir", rootDirectory); + Path rootDirectory = Files.createTempDirectory(null); + Path subDirectory = createDirectoryIn("subdir", rootDirectory); ResourceAccumulator resourceAccumulator = - new ResourceAccumulator(rootDirectory.toPath(), createInclusivePathPrefixSet()); + new ResourceAccumulator(rootDirectory, createInclusivePathPrefixSet()); assertTrue(getResources(resourceAccumulator).isEmpty()); @@ -52,18 +54,18 @@ public void testAddFile() throws Exception { } public void testDeleteFile() throws Exception { - File rootDirectory = Files.createTempDir(); - File subDirectory = createDirectoryIn("subdir", rootDirectory); - File originalFile = createFileIn("SomeFile.java", subDirectory); + Path rootDirectory = Files.createTempDirectory(null); + Path subDirectory = createDirectoryIn("subdir", rootDirectory); + Path originalFile = createFileIn("SomeFile.java", subDirectory); ResourceAccumulator resourceAccumulator = - new ResourceAccumulator(rootDirectory.toPath(), createInclusivePathPrefixSet()); + new ResourceAccumulator(rootDirectory, createInclusivePathPrefixSet()); List resources = getResources(resourceAccumulator); assertEquals(1, resources.size()); assertTrue(resources.get(0).getPath().endsWith("SomeFile.java")); - originalFile.delete(); + Files.delete(originalFile); waitForFileEvents(); assertTrue(getResources(resourceAccumulator).isEmpty()); @@ -72,16 +74,16 @@ public void testDeleteFile() throws Exception { } public void testListensInNewDirectories() throws Exception { - File rootDirectory = Files.createTempDir(); + Path rootDirectory = Files.createTempDirectory(null); ResourceAccumulator resourceAccumulator = - new ResourceAccumulator(rootDirectory.toPath(), createInclusivePathPrefixSet()); + new ResourceAccumulator(rootDirectory, createInclusivePathPrefixSet()); assertTrue(getResources(resourceAccumulator).isEmpty()); // Create a new directory and contained file AFTER the root directory has started being listened // to. - File subDirectory = createDirectoryIn("subdir", rootDirectory); + Path subDirectory = createDirectoryIn("subdir", rootDirectory); createFileIn("New.java", subDirectory); waitForFileEvents(); @@ -93,13 +95,13 @@ public void testListensInNewDirectories() throws Exception { } public void testMultipleListeners() throws Exception { - File rootDirectory = Files.createTempDir(); - File subDirectory = createDirectoryIn("subdir", rootDirectory); + Path rootDirectory = Files.createTempDirectory(null); + Path subDirectory = createDirectoryIn("subdir", rootDirectory); ResourceAccumulator resourceAccumulator1 = - new ResourceAccumulator(rootDirectory.toPath(), createInclusivePathPrefixSet()); + new ResourceAccumulator(rootDirectory, createInclusivePathPrefixSet()); ResourceAccumulator resourceAccumulator2 = - new ResourceAccumulator(rootDirectory.toPath(), createInclusivePathPrefixSet()); + new ResourceAccumulator(rootDirectory, createInclusivePathPrefixSet()); assertTrue(getResources(resourceAccumulator1).isEmpty()); assertTrue(getResources(resourceAccumulator2).isEmpty()); @@ -120,19 +122,19 @@ public void testMultipleListeners() throws Exception { } public void testRenameFile() throws Exception { - File rootDirectory = Files.createTempDir(); - File subDirectory = createDirectoryIn("subdir", rootDirectory); - File originalFile = createFileIn("OriginalName.java", subDirectory); - File renamedFile = new File(subDirectory, "Renamed.java"); + Path rootDirectory = Files.createTempDirectory(null); + Path subDirectory = createDirectoryIn("subdir", rootDirectory); + Path originalFile = createFileIn("OriginalName.java", subDirectory); + Path renamedFile = subDirectory.resolve("Renamed.java"); ResourceAccumulator resourceAccumulator = - new ResourceAccumulator(rootDirectory.toPath(), createInclusivePathPrefixSet()); + new ResourceAccumulator(rootDirectory, createInclusivePathPrefixSet()); List resources = getResources(resourceAccumulator); assertEquals(1, resources.size()); assertTrue(resources.get(0).getPath().endsWith("OriginalName.java")); - originalFile.renameTo(renamedFile); + Files.move(originalFile, renamedFile); waitForFileEvents(); resources = getResources(resourceAccumulator); @@ -143,21 +145,21 @@ public void testRenameFile() throws Exception { } public void testRenameDirectory() throws Exception { - File rootDirectory = Files.createTempDir(); - File subDirectory = createDirectoryIn("original_dir", rootDirectory); + Path rootDirectory = Files.createTempDirectory(null); + Path subDirectory = createDirectoryIn("original_dir", rootDirectory); createFileIn("Name1.java", subDirectory); createFileIn("Name2.java", subDirectory); - File renamedSubDirectory = new File(rootDirectory, "new_dir"); + Path renamedSubDirectory = rootDirectory.resolve("new_dir"); ResourceAccumulator resourceAccumulator = - new ResourceAccumulator(rootDirectory.toPath(), createInclusivePathPrefixSet()); + new ResourceAccumulator(rootDirectory, createInclusivePathPrefixSet()); List resources = getResources(resourceAccumulator); assertEquals(2, resources.size()); assertTrue(resources.get(0).getPath().endsWith("original_dir/Name1.java")); assertTrue(resources.get(1).getPath().endsWith("original_dir/Name2.java")); - subDirectory.renameTo(renamedSubDirectory); + Files.move(subDirectory, renamedSubDirectory); waitForFileEvents(); resources = getResources(resourceAccumulator); @@ -169,22 +171,25 @@ public void testRenameDirectory() throws Exception { } public void testRenameParentDirectory() throws Exception { - File rootDirectory = Files.createTempDir(); - File parentDirectory = createDirectoryIn("original_dir", rootDirectory); - File subDirectory = createDirectoryIn("subdir", parentDirectory); + if (SystemUtils.IS_OS_WINDOWS) { + return; // moving a directory while WatchService is running -> access denied + } + Path rootDirectory = Files.createTempDirectory(null); + Path parentDirectory = createDirectoryIn("original_dir", rootDirectory); + Path subDirectory = createDirectoryIn("subdir", parentDirectory); createFileIn("Name1.java", subDirectory); createFileIn("Name2.java", subDirectory); - File renamedParentDirectory = new File(rootDirectory, "new_dir"); + Path renamedParentDirectory = rootDirectory.resolve("new_dir"); ResourceAccumulator resourceAccumulator = - new ResourceAccumulator(rootDirectory.toPath(), createInclusivePathPrefixSet()); + new ResourceAccumulator(rootDirectory, createInclusivePathPrefixSet()); List resources = getResources(resourceAccumulator); assertEquals(2, resources.size()); assertTrue(resources.get(0).getPath().endsWith("original_dir/subdir/Name1.java")); assertTrue(resources.get(1).getPath().endsWith("original_dir/subdir/Name2.java")); - parentDirectory.renameTo(renamedParentDirectory); + Files.move(parentDirectory, renamedParentDirectory); waitForFileEvents(); resources = getResources(resourceAccumulator); @@ -196,19 +201,22 @@ public void testRenameParentDirectory() throws Exception { } public void testSymlinkInfiniteLoop() throws Exception { - File rootDirectory = Files.createTempDir(); - File subDirectory = Files.createTempDir(); + if (SystemUtils.IS_OS_WINDOWS) { + return; // symlinks not working on Windows + } + Path rootDirectory = Files.createTempDirectory(null); + Path subDirectory = Files.createTempDirectory(null); ResourceAccumulator resourceAccumulator = - new ResourceAccumulator(rootDirectory.toPath(), createInclusivePathPrefixSet()); + new ResourceAccumulator(rootDirectory, createInclusivePathPrefixSet()); assertTrue(getResources(resourceAccumulator).isEmpty()); // Symlink in a loop - java.nio.file.Files.createSymbolicLink(new File(rootDirectory, "sublink").toPath(), - subDirectory.toPath()).toFile(); - java.nio.file.Files.createSymbolicLink(new File(subDirectory, "sublink").toPath(), - rootDirectory.toPath()).toFile(); + java.nio.file.Files.createSymbolicLink(rootDirectory.resolve("sublink"), + subDirectory); + java.nio.file.Files.createSymbolicLink(subDirectory.resolve("sublink"), + rootDirectory); createFileIn("New.java", subDirectory); waitForFileEvents(); @@ -224,21 +232,24 @@ public void testSymlinkInfiniteLoop() throws Exception { } public void testSymlinks() throws Exception { - File scratchDirectory = Files.createTempDir(); - File newFile = createFileIn("New.java", scratchDirectory); - File rootDirectory = Files.createTempDir(); - File subDirectory = Files.createTempDir(); + if (SystemUtils.IS_OS_WINDOWS) { + return; // symlinks not working on Windows + } + Path scratchDirectory = Files.createTempDirectory(null); + Path newFile = createFileIn("New.java", scratchDirectory); + Path rootDirectory = Files.createTempDirectory(null); + Path subDirectory = Files.createTempDirectory(null); ResourceAccumulator resourceAccumulator = - new ResourceAccumulator(rootDirectory.toPath(), createInclusivePathPrefixSet()); + new ResourceAccumulator(rootDirectory, createInclusivePathPrefixSet()); assertTrue(getResources(resourceAccumulator).isEmpty()); // Symlink in a subdirectory and then symlink in a contained file. - java.nio.file.Files.createSymbolicLink(new File(rootDirectory, "sublink").toPath(), - subDirectory.toPath()).toFile(); - java.nio.file.Files.createSymbolicLink(new File(subDirectory, "New.java").toPath(), - newFile.toPath()).toFile(); + Files.createSymbolicLink(rootDirectory.resolve("sublink"), + subDirectory); + Files.createSymbolicLink(subDirectory.resolve("New.java"), + newFile); waitForFileEvents(); List resources = getResources(resourceAccumulator); @@ -248,16 +259,14 @@ public void testSymlinks() throws Exception { resourceAccumulator.shutdown(); } - private static File createDirectoryIn(String fileName, File inDirectory) { - File newDirectory = new File(inDirectory, fileName); - newDirectory.mkdir(); - return newDirectory; + private static Path createDirectoryIn(String fileName, Path inDirectory) throws IOException { + Path newDirectory = inDirectory.resolve(fileName); + return Files.createDirectory(newDirectory); } - private static File createFileIn(String fileName, File inDirectory) throws IOException { - File newFile = new File(inDirectory, fileName); - newFile.createNewFile(); - return newFile; + private static Path createFileIn(String fileName, Path inDirectory) throws IOException { + Path newFile = inDirectory.resolve(fileName); + return Files.createFile(newFile); } private List getResources(ResourceAccumulator resourceAccumulator) @@ -284,7 +293,7 @@ private PathPrefixSet createInclusivePathPrefixSet() { PathPrefixSet pathPrefixSet = new PathPrefixSet(); pathPrefixSet.add(new PathPrefix("", null)); - // Keep the the reference until the end of the test to create a strong reference, otherwise + // Keep the reference until the end of the test to create a strong reference, otherwise // will get GCed as ResourceAccumulator refers to it weakly. pathPrefixes.add(pathPrefixSet); return pathPrefixSet; diff --git a/doc/build.xml b/doc/build.xml index 14924f982bd..0c9486c00b0 100644 --- a/doc/build.xml +++ b/doc/build.xml @@ -101,19 +101,18 @@ access="package" packagenames="${USER_PKGS}" sourcefiles="${USER_CLASSES}" - noindex="true" - notree="true" use="true" windowtitle="GWT Javadoc" doctitle="GWT API Reference" header="GWT ${gwt.version}" - linkoffline="http://download.oracle.com/javaee/6/api/ validation-package-list"> + linkoffline="https://docs.oracle.com/en/java/javase/11/docs/api/ validation-package-list"> - - + + + diff --git a/maven/lib-gwt.sh b/maven/lib-gwt.sh index bd744b254ea..e5ea920feb7 100644 --- a/maven/lib-gwt.sh +++ b/maven/lib-gwt.sh @@ -67,6 +67,13 @@ function maven-gwt() { JAVADOC_FILE_PATH=$RANDOM_DIR/gwt-javadoc.jar #TODO also wrong for jakarta [ -d $GWT_EXTRACT_DIR/doc/javadoc ] && jar cf $JAVADOC_FILE_PATH -C $GWT_EXTRACT_DIR/doc/javadoc . + JAVADOC_JAKARTA_FILE_PATH=$RANDOM_DIR/gwt-jakarta-javadoc.jar + if [[ -d $GWT_EXTRACT_DIR/doc/javadoc ]]; then + cp -r $GWT_EXTRACT_DIR/doc/javadoc $GWT_EXTRACT_DIR/doc/javadoc-jakarta + find $GWT_EXTRACT_DIR/doc/javadoc-jakarta -type f -exec sed -i 's/javax.servlet/jakarta.servlet/g' {} + + jar cf $JAVADOC_JAKARTA_FILE_PATH -C $GWT_EXTRACT_DIR/doc/javadoc-jakarta . + fi + # Generate POMs with correct version for template in `find $pomDir -name pom-template.xml` do @@ -118,14 +125,17 @@ function maven-gwt() { # If there are no sources, use gwt-user sources. # This is a bit hacky but Sonatype requires a # source jar for Central, and lack of sources - # should only happen for gwt-servlet and - # gwt-servlet-jakarta which are basically a + # should only happen for gwt-servlet which are basically a # subset of gwt-user. - #TODO this is wrong for jakarta sources + # For servlet-jakarta, a seperate source file is built. if [ ! -f $SOURCES_PATH_FILE ]; then SOURCES_PATH_FILE=$GWT_EXTRACT_DIR/gwt-user-sources.jar fi + if [[ $i == "servlet-jakarta" ]]; then + JAVADOC_FILE_PATH=$JAVADOC_JAKARTA_FILE_PATH + fi + maven-deploy-file $mavenRepoUrl $mavenRepoId "$CUR_FILE" $gwtPomFile "$JAVADOC_FILE_PATH" "$SOURCES_PATH_FILE" || die done diff --git a/servlet/build.xml b/servlet/build.xml index 232a7ea871b..afec4dae2d3 100644 --- a/servlet/build.xml +++ b/servlet/build.xml @@ -9,7 +9,7 @@ - + @@ -81,7 +81,7 @@ - + diff --git a/user/build.xml b/user/build.xml index 890d2e6d1e2..68ac7c94a49 100755 --- a/user/build.xml +++ b/user/build.xml @@ -75,8 +75,8 @@ - - + +