diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 58179ef9f3..7701eabf0b 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -21,6 +21,8 @@ jobs: java: 11 - os: ubuntu-latest java: 17 + - os: ubuntu-latest + java: 21 fail-fast: false runs-on: ${{ matrix.os }} steps: diff --git a/cast/js/html/nu_validator/src/main/java/com/ibm/wala/cast/js/html/nu_validator/NuValidatorHtmlParser.java b/cast/js/html/nu_validator/src/main/java/com/ibm/wala/cast/js/html/nu_validator/NuValidatorHtmlParser.java index ac48364749..dec7a13abc 100644 --- a/cast/js/html/nu_validator/src/main/java/com/ibm/wala/cast/js/html/nu_validator/NuValidatorHtmlParser.java +++ b/cast/js/html/nu_validator/src/main/java/com/ibm/wala/cast/js/html/nu_validator/NuValidatorHtmlParser.java @@ -22,6 +22,8 @@ import java.io.Reader; import java.io.StringReader; import java.net.MalformedURLException; +import java.net.URI; +import java.net.URISyntaxException; import java.net.URL; import java.util.AbstractMap; import java.util.ArrayDeque; @@ -43,8 +45,8 @@ public void parse( final URL url, final Reader reader, final IHtmlCallback handler, final String fileName) { URL xx = null; try { - xx = new URL("file://" + fileName); - } catch (MalformedURLException e1) { + xx = new URI("file://" + fileName).toURL(); + } catch (MalformedURLException | URISyntaxException e1) { e1.printStackTrace(); } final URL localFileName = xx; diff --git a/cast/js/rhino/src/test/java/com/ibm/wala/cast/js/rhino/callgraph/fieldbased/test/FieldBasedCGGamesTest.java b/cast/js/rhino/src/test/java/com/ibm/wala/cast/js/rhino/callgraph/fieldbased/test/FieldBasedCGGamesTest.java index 1f62fa683d..fe4424b8e0 100644 --- a/cast/js/rhino/src/test/java/com/ibm/wala/cast/js/rhino/callgraph/fieldbased/test/FieldBasedCGGamesTest.java +++ b/cast/js/rhino/src/test/java/com/ibm/wala/cast/js/rhino/callgraph/fieldbased/test/FieldBasedCGGamesTest.java @@ -5,6 +5,9 @@ import com.ibm.wala.util.CancelException; import com.ibm.wala.util.WalaException; import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URI; +import java.net.URISyntaxException; import java.net.URL; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Tag; @@ -15,21 +18,29 @@ public class FieldBasedCGGamesTest extends AbstractFieldBasedTest { @Test public void testBunnyHunt() throws IOException, WalaException, Error, CancelException { - URL url = new URL("http://www.themaninblue.com/experiment/BunnyHunt/"); + URL url = getUrl("http://www.themaninblue.com/experiment/BunnyHunt/"); runTest(url, new Object[][] {}, BuilderType.OPTIMISTIC); } + private static URL getUrl(String urlStr) throws MalformedURLException { + try { + return new URI(urlStr).toURL(); + } catch (URISyntaxException e) { + throw new RuntimeException(e); + } + } + @Disabled("seems to break with http issues") @Test public void testBeslimed() throws IOException, WalaException, Error, CancelException { - URL url = new URL("http://www.markus-inger.de/test/game.php"); + URL url = getUrl("http://www.markus-inger.de/test/game.php"); runTest(url, new Object[][] {}, BuilderType.OPTIMISTIC); } @Disabled("seems to break with http issues") @Test public void testDiggAttack() throws IOException, WalaException, Error, CancelException { - URL url = new URL("http://www.pixastic.com/labs/digg_attack/"); + URL url = getUrl("http://www.pixastic.com/labs/digg_attack/"); runTest(url, new Object[][] {}, BuilderType.OPTIMISTIC); } @@ -37,7 +48,7 @@ public void testDiggAttack() throws IOException, WalaException, Error, CancelExc @Test public void testRiverRaider() throws IOException, WalaException, Error, CancelException { URL url = - new URL( + getUrl( "http://playstar.mobi/games/riverraider/index.html?playerId=&gameId=8&highscore=102425"); runTest(url, new Object[][] {}, BuilderType.OPTIMISTIC_WORKLIST); } @@ -45,31 +56,31 @@ public void testRiverRaider() throws IOException, WalaException, Error, CancelEx @Disabled("fails with \"timed out\" CancelException") @Test public void testSolitaire() throws IOException, WalaException, Error, CancelException { - URL url = new URL("http://www.inmensia.com/files/solitaire1.0.html"); + URL url = getUrl("http://www.inmensia.com/files/solitaire1.0.html"); runTest(url, new Object[][] {}, BuilderType.OPTIMISTIC); } @Test // (expected = CancelException.class) public void testWorldOfSolitaire() throws IOException, WalaException, Error, CancelException { - URL url = new URL("http://worldofsolitaire.com/"); + URL url = getUrl("http://worldofsolitaire.com/"); runTest(url, new Object[][] {}, BuilderType.OPTIMISTIC); } @Test public void testMinesweeper() throws IOException, WalaException, Error, CancelException { - URL url = new URL("http://www.inmensia.com/files/minesweeper1.0.html"); + URL url = getUrl("http://www.inmensia.com/files/minesweeper1.0.html"); runTest(url, new Object[][] {}, BuilderType.OPTIMISTIC_WORKLIST); } @Test public void testProtoRPG() throws IOException, WalaException, Error, CancelException { - URL url = new URL("http://www.protorpg.com/games/protorpg/?game=prologue"); + URL url = getUrl("http://www.protorpg.com/games/protorpg/?game=prologue"); runTest(url, new Object[][] {}, BuilderType.OPTIMISTIC_WORKLIST); } @Test public void testBattleship() throws IOException, WalaException, Error, CancelException { - URL url = new URL("http://www.sinkmyship.com/battleship/single.html"); + URL url = getUrl("http://www.sinkmyship.com/battleship/single.html"); runTest(url, new Object[][] {}, BuilderType.OPTIMISTIC_WORKLIST); } } diff --git a/cast/js/rhino/src/test/java/com/ibm/wala/cast/js/rhino/callgraph/fieldbased/test/FieldBasedJQueryTest.java b/cast/js/rhino/src/test/java/com/ibm/wala/cast/js/rhino/callgraph/fieldbased/test/FieldBasedJQueryTest.java index 898a96ac7d..ed999afbff 100644 --- a/cast/js/rhino/src/test/java/com/ibm/wala/cast/js/rhino/callgraph/fieldbased/test/FieldBasedJQueryTest.java +++ b/cast/js/rhino/src/test/java/com/ibm/wala/cast/js/rhino/callgraph/fieldbased/test/FieldBasedJQueryTest.java @@ -5,7 +5,8 @@ import com.ibm.wala.util.CancelException; import com.ibm.wala.util.WalaException; import java.io.IOException; -import java.net.URL; +import java.net.URI; +import java.net.URISyntaxException; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; @@ -13,9 +14,10 @@ public class FieldBasedJQueryTest extends AbstractFieldBasedTest { @Test - public void test1_8_2() throws IOException, WalaException, Error, CancelException { + public void test1_8_2() + throws IOException, WalaException, Error, CancelException, URISyntaxException { runTest( - new URL("http://code.jquery.com/jquery-1.8.2.js"), + new URI("http://code.jquery.com/jquery-1.8.2.js").toURL(), new Object[][] {}, BuilderType.OPTIMISTIC_WORKLIST); } diff --git a/cast/js/rhino/src/test/java/com/ibm/wala/cast/js/rhino/test/HTMLCGBuilder.java b/cast/js/rhino/src/test/java/com/ibm/wala/cast/js/rhino/test/HTMLCGBuilder.java index 8fdb6e260f..a3e6e4bb72 100644 --- a/cast/js/rhino/src/test/java/com/ibm/wala/cast/js/rhino/test/HTMLCGBuilder.java +++ b/cast/js/rhino/src/test/java/com/ibm/wala/cast/js/rhino/test/HTMLCGBuilder.java @@ -35,6 +35,8 @@ import java.io.FileNotFoundException; import java.io.IOException; import java.net.MalformedURLException; +import java.net.URI; +import java.net.URISyntaxException; import java.net.URL; import java.util.Properties; import java.util.function.Supplier; @@ -78,7 +80,7 @@ public static CGBuilderResult buildHTMLCG( URL url = null; try { url = toUrl(src); - } catch (MalformedURLException e1) { + } catch (MalformedURLException | URISyntaxException e1) { fail("Could not find page to analyse: " + src); } com.ibm.wala.cast.js.ipa.callgraph.JSCallGraphUtil.setTranslatorFactory( @@ -118,7 +120,7 @@ public static CGBuilderResult buildHTMLCG( } } - private static URL toUrl(String src) throws MalformedURLException { + private static URL toUrl(String src) throws MalformedURLException, URISyntaxException { // first try interpreting as local file name, if that doesn't work just // assume it's a URL try { @@ -126,7 +128,7 @@ private static URL toUrl(String src) throws MalformedURLException { URL url = f.toURI().toURL(); return url; } catch (FileNotFoundException fnfe) { - return new URL(src); + return new URI(src).toURL(); } } diff --git a/cast/js/rhino/src/test/java/com/ibm/wala/cast/js/vis/JsViewerDriver.java b/cast/js/rhino/src/test/java/com/ibm/wala/cast/js/vis/JsViewerDriver.java index 8739b8218e..85edcff89a 100644 --- a/cast/js/rhino/src/test/java/com/ibm/wala/cast/js/vis/JsViewerDriver.java +++ b/cast/js/rhino/src/test/java/com/ibm/wala/cast/js/vis/JsViewerDriver.java @@ -34,6 +34,8 @@ import com.ibm.wala.util.CancelException; import com.ibm.wala.util.WalaException; import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; import java.net.URL; import java.util.Set; @@ -44,7 +46,8 @@ public static void main(String args[]) IOException, CancelException, Error, - WalaException { + WalaException, + URISyntaxException { if (args.length != 1) { System.out.println("Usage: "); @@ -52,7 +55,7 @@ public static void main(String args[]) } boolean domless = false; - URL url = new URL(args[0]); + URL url = new URI(args[0]).toURL(); // computing CG + PA JSCallGraphUtil.setTranslatorFactory(new CAstRhinoTranslatorFactory()); diff --git a/core/src/main/resources/natives.xml b/core/src/main/resources/natives.xml index 034159ec4c..49c22ef2eb 100644 --- a/core/src/main/resources/natives.xml +++ b/core/src/main/resources/natives.xml @@ -490,6 +490,15 @@ fieldType="Ljava/lang/Runnable" ref="arg0" value="arg0" /> + + + + + @@ -497,6 +506,15 @@ fieldType="Ljava/lang/Runnable" ref="arg0" value="arg1" /> + + + + + @@ -518,6 +536,15 @@ fieldType="Ljava/lang/Runnable" def="y" ref="arg0" /> + + + + + diff --git a/dalvik/build.gradle.kts b/dalvik/build.gradle.kts index 4d8891fb04..f74a6a27b6 100644 --- a/dalvik/build.gradle.kts +++ b/dalvik/build.gradle.kts @@ -192,6 +192,12 @@ if (isWindows) tasks.named("test") { exclude("**/droidbench/**") } else sourceSets.test.configure { resources.srcDir(unpackDroidBench) } tasks.named("test") { + if (JavaVersion.current() == JavaVersion.VERSION_21) { + // Disable the task for JDK 21 for now. We have test failures due to a required r8 upgrade + // that introduces some new behaviors we don't expect + // See https://github.com/wala/WALA/issues/1349 + enabled = false + } maxHeapSize = "800M" outputs.files( diff --git a/ide/jsdt/src/main/java/com/ibm/wala/ide/util/EclipseWebProjectPath.java b/ide/jsdt/src/main/java/com/ibm/wala/ide/util/EclipseWebProjectPath.java index ac8e50743b..c034251f59 100644 --- a/ide/jsdt/src/main/java/com/ibm/wala/ide/util/EclipseWebProjectPath.java +++ b/ide/jsdt/src/main/java/com/ibm/wala/ide/util/EclipseWebProjectPath.java @@ -11,7 +11,8 @@ import com.ibm.wala.util.collections.Pair; import java.io.IOException; import java.net.MalformedURLException; -import java.net.URL; +import java.net.URI; +import java.net.URISyntaxException; import java.util.Iterator; import java.util.List; import java.util.Set; @@ -51,9 +52,11 @@ protected void resolveSourcePathEntry( String urlString = "file://" + htmlPage.getAbsolutePath(); try { scripts = - WebUtil.extractScriptFromHTML(new URL(urlString), DefaultSourceExtractor.factory).fst; + WebUtil.extractScriptFromHTML( + new URI(urlString).toURL(), DefaultSourceExtractor.factory) + .fst; s.addAll(scripts); - } catch (MalformedURLException e1) { + } catch (URISyntaxException | MalformedURLException e1) { assert false : "internal error constructing URL " + urlString; } catch (Error e1) { System.err.print("skipping " + htmlPage.getAbsolutePath() + ": " + e1.warning); diff --git a/ide/src/main/java/com/ibm/wala/ide/util/EclipseFileProvider.java b/ide/src/main/java/com/ibm/wala/ide/util/EclipseFileProvider.java index e0b01671d9..1788683834 100644 --- a/ide/src/main/java/com/ibm/wala/ide/util/EclipseFileProvider.java +++ b/ide/src/main/java/com/ibm/wala/ide/util/EclipseFileProvider.java @@ -20,6 +20,8 @@ import java.io.IOException; import java.lang.reflect.Method; import java.net.MalformedURLException; +import java.net.URI; +import java.net.URISyntaxException; import java.net.URL; import java.util.jar.JarFile; import org.eclipse.core.runtime.FileLocator; @@ -166,8 +168,8 @@ private static URL fixupFileURLSpaces(URL url) { lastIndex = spaceIndex + 1; } try { - return new URL(fixedUpUrl.toString()); - } catch (MalformedURLException e) { + return new URI(fixedUpUrl.toString()).toURL(); + } catch (MalformedURLException | URISyntaxException e) { e.printStackTrace(); Assertions.UNREACHABLE(); } diff --git a/shrike/src/main/java/com/ibm/wala/shrike/shrikeCT/ClassReader.java b/shrike/src/main/java/com/ibm/wala/shrike/shrikeCT/ClassReader.java index 1f17602544..3b34a1a1e1 100644 --- a/shrike/src/main/java/com/ibm/wala/shrike/shrikeCT/ClassReader.java +++ b/shrike/src/main/java/com/ibm/wala/shrike/shrikeCT/ClassReader.java @@ -67,8 +67,8 @@ private void parse() throws InvalidClassFileException { if (magic != MAGIC) { throw new InvalidClassFileException(offset, "bad magic number: " + magic); } - // Support class files up through JDK 17 (version 61) - if (majorVersion < 45 || majorVersion > 61) { + // Support class files up through JDK 21 (version 65) + if (majorVersion < 45 || majorVersion > 65) { throw new InvalidClassFileException( offset, "unknown class file version: " + majorVersion + '.' + minorVersion); }