aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/test/java
Commit message (Collapse)AuthorAgeFilesLines
...
* Cosmetic fixes in Java 18 tests (e.g. copyright year 2022)Alexander Kriegisch2022-10-035-7/+7
| | | | Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* vuln-fix: Partial Path Traversal VulnerabilityJonathan Leitschuh2022-09-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | This fixes a partial path traversal vulnerability. Replaces `dir.getCanonicalPath().startsWith(parent.getCanonicalPath())`, which is vulnerable to partial path traversal attacks, with the more secure `dir.getCanonicalFile().toPath().startsWith(parent.getCanonicalFile().toPath())`. To demonstrate this vulnerability, consider `"/usr/outnot".startsWith("/usr/out")`. The check is bypassed although `/outnot` is not under the `/out` directory. It's important to understand that the terminating slash may be removed when using various `String` representations of the `File` object. For example, on Linux, `println(new File("/var"))` will print `/var`, but `println(new File("/var", "/")` will print `/var/`; however, `println(new File("/var", "/").getCanonicalPath())` will print `/var`. Weakness: CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') Severity: Medium CVSSS: 6.1 Detection: CodeQL & OpenRewrite (https://public.moderne.io/recipes/org.openrewrite.java.security.PartialPathTraversalVulnerability) Reported-by: Jonathan Leitschuh <Jonathan.Leitschuh@gmail.com> Signed-off-by: Jonathan Leitschuh <Jonathan.Leitschuh@gmail.com> Bug-tracker: https://github.com/JLLeitschuh/security-research/issues/13 Co-authored-by: Moderne <team@moderne.io>
* Make IStateListener.aboutToCompareClasspaths use typed listsAlexander Kriegisch2022-04-182-3/+2
| | | | | | | | | | | | | | | | Before, the signature was: void aboutToCompareClasspaths( List oldClasspath, List newClasspath); Now it is: void aboutToCompareClasspaths( List<String> oldClasspath, List<String> newClasspath); AJDT will also use the typed version after generics refactoring. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Revert "AtAjLTWTests: 4 test cases switched to 'useFullLTW' mode"Alexander Kriegisch2022-03-311-4/+3
| | | | This reverts commit 5288ef1c1c8be2df85e59740f41622f4cfb9d899.
* Add some smoke test cases for '--add-reads' and '--add-modules'Alexander Kriegisch2022-03-311-1/+13
| | | | | | | in order to show that the compiler options basically work. The test cases are by no means exhaustive and simply verify that it works at all. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Add test case + experimental fix for AJC option '--add-exports'Alexander Kriegisch2022-03-271-0/+4
| | | | | | | I am expecting the test case to pass, but other tests to fail. This temporary commit is meant to create feedback from GitHub CI test runs. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Add AllTestsAspectJ199.suite() to AllTests19Alexander Kriegisch2022-03-241-0/+2
| | | | Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Upgrade to latest JDT Core Java 18 changes, activate J18 preview testsAlexander Kriegisch2022-03-241-12/+8
| | | | Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Rename testGitHub_125 to testCompilerCanReopenClosedJARs_gh125Alexander Kriegisch2022-03-231-1/+1
| | | | Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Move GH-128 tests from 1.9.8 to 1.9.9 bugs test suite after mergeAlexander Kriegisch2022-03-232-17/+17
| | | | Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Merge branch 'master' into java-18Alexander Kriegisch2022-03-231-0/+17
|\ | | | | | | | | | | # Conflicts: # tests/src/test/java/org/aspectj/systemtest/ajc198/Bugs198Tests.java # tests/src/test/resources/org/aspectj/systemtest/ajc198/ajc198.xml
| * Ignore testAsyncProceedNestedAroundAdviceThreadPool_gh128 for nowAlexander Kriegisch2022-03-231-1/+2
| | | | | | | | | | | | Out of scope for PR #132, future work for issue #141. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
| * Expand "asynchronous proceed for nested around-advice" to 4 scenarios:Alexander Kriegisch2022-03-231-1/+13
| | | | | | | | | | | | | | | | | | | | | | 1. @AspectJ syntax, threads created inside advice code 2. @AspectJ syntax, submit runnable to thread pool 3. native syntax, threads created inside advice code 4. native syntax, submit runnable to thread pool Scenarios 1, 3 and 4 are passing, while 2 is failing. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
| * Add test "asynchronous proceed for nested around-advice chain"Alexander Kriegisch2022-03-231-0/+4
| | | | | | | | | | | | Relates to #128. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* | A few dozen more tests need 'useFullLTW' modeAlexander Kriegisch2022-03-231-1/+1
| | | | | | | | Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* | AtAjLTWTests: 4 test cases switched to 'useFullLTW' modeAlexander Kriegisch2022-03-231-3/+4
| | | | | | | | | | | | | | | | After the Java 18 JDT Core upgrade, some LTW tests are failing and have to be switched from in-process to full LTW mode due to them now obviously calling some code paths which need '--add-opens'. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* | Prepare code, tests and docs for Java 18Alexander Kriegisch2022-03-218-57/+302
|/ | | | | | | | | | | | | | | | | | | | - JDT Core dependency in pom.xml - Constants.java - LangUtil.java - AjcTask.java - messages_aspectj.properties - XMLBasedAjcTestCaseForJava17Only.java - XMLBasedAjcTestCaseForJava18*.java - tests/bugs199 - tests/features199 - JavaVersionCompatibility.md - README-199.html - GitHub CI build Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Regression test for #125: Bugs198Tests.testGitHub_125Alexander Kriegisch2022-02-231-3/+12
| | | | | | | | | | | | | | | | | | | | | | | | This test fails when run against AspectJ 1.9.8 with JDT Core 1.9.8.RC3. It passes when using the latest JDT Core 1.9.9-SNAPSHOT. It sets system property 'org.aspectj.weaver.openarchives=20', provoking open classpath JAR file exhaustion when compiling a simple class with AJC, i.e. JARs are being forcibly closed and automatically re-opened, as soon as they are needed. Before the JDT Core bugfix, this test causes: java.lang.NullPointerException at ....compiler.batch.ClasspathJmod.getModulesDeclaringPackage With the bugfix incorporated into AspectJ Tools, the problem is gone. Note: New test dependency 'io.github.bmuskalla:scoped-system-properties' helps to test compilation with the temporarily changed global system property in isolation, saving the environment in a thread-local variable and later cleanly restoring the original values again. If we ever switch to parallel test execution, this would otherwise influence other tests and potentially cause weird side effects. Better safe than sorry. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Move some tests from Ajc198TestsJava to Bugs198TestsAlexander Kriegisch2022-02-232-20/+20
| | | | | | | | | They were accidentally stored in thw wrong test class, not just because they are bug regression tests, not 1.9.8 features, but also because they are meant to work on Java 5+, not on Java 17+ like the ones in Ajc198TestsJava. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Improve annotation style if pointcut handlingAndy Clement2022-01-311-15/+30
| | | | | | | | | This fixes: - negating annotation style if() pointcuts doesn't work - annotation style if() pointcut not able to use a binding that is not exposed Fixes #120,#122
* Fix annotation style support for if(true) and if(false)Andy Clement2022-01-171-0/+8
| | | | | | | | | | The documentation specifies annotation style pointcuts can use if(false) or if(true) and not require a boolean return value and body for the @Pointcut annotated method but it doesn't work without this change to validation that recognizes the situation. Fixes #115
* Add test for Java 11 constant-dynamicAlexander Kriegisch2022-01-082-0/+35
| | | | | | Relates to #68. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Merge pull request #102 from turbanoff/trim_trailing_whitespacesAndy Clement2021-11-304-7/+7
|\ | | | | Trim trailing whitespaces.
| * Trim trailing whitespaces.Andrey Turbanov2021-11-204-7/+7
| | | | | | | | | | Trailing whitespaces are useless. Most of code-styles forbids them. Most of editors always trim them on save. I propose to clean up project from trailing whitespaces in all java files at once.
* | Merge pull request #101 from turbanoff/use_StringBuilder_instead_of_StringBufferAndy Clement2021-11-306-15/+15
|\ \ | | | | | | Replace uses of StringBuffer with StringBuilder.
| * | Replace uses of StringBuffer with StringBuilder.Andrey Turbanov2021-11-206-15/+15
| |/ | | | | | | StringBuffer is a legacy synchronized class. StringBuilder is a direct replacement to StringBuffer which generally have better performance.
* | Add forgotten Bugs198Tests to test suiteAlexander Kriegisch2021-11-262-0/+6
| | | | | | | | Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* | Incorporate JDT Core fix + test for #105Alexander Kriegisch2021-11-261-0/+26
|/ | | | Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Update ECJ version, activate Java 17 preview features testsAlexander Kriegisch2021-10-021-14/+8
| | | | | | | After JDT Core (ECJ) was updated to the final Java 17 feature set, the tests now pass as expected. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Add + activate some Java 17 testsAlexander Kriegisch2021-09-072-46/+35
| | | | | | | | | | | | | - Fix one fault sanity test configuration - Deactivate Java 16 preview tests (no longer supported by Java 17 compiler) - Test sealed classes as final on Java 17 (no longer preview) - Add tests for JEP 406, pattern matching for switch (preview). At present, the beta 17 branch of JDT Core does not handle the tested features and expected compile errors correctly yet, so I had to temporarily deactivate test execution, only printing TODO messages. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Test comment cosmeticsAlexander Kriegisch2021-09-079-9/+12
| | | | Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Add integration test for '--release N' compiler optionAlexander Kriegisch2021-06-262-0/+76
| | | | | | Relates to #70 Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Add AspectJ 1.9.7 and Java 17 test skeletonsAlexander Kriegisch2021-06-265-0/+230
| | | | Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Upgrade license from CPLv1/EPLv1 to EPLv2Alexander Kriegisch2021-06-04190-1181/+1181
| | | | | | | This was required by the Eclipse team as one precondition for the next release. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Make all tests run on Java 16 via '-add-opens' JVM optionjava16-add-opensAlexander Kriegisch2021-03-231-7/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Due to JEP 260 (Encapsulate Most Internal APIs), aspect weaving on Java 16 now requires '--add-opens java.base/java.lang=ALL-UNNAMED' on the command line. Otherwise there will be illegal access exceptions for some internal API calls AspectJ needs, most prominently when trying to define classes in other packages or modules. This had to be done on several levels: - Maven Surefire: running tests in a JVM directly forked by Surefire. In order to make this backwards compatible, I added two profiles with JDK-level-dependent auto-activation, one 8-15 and one 16+. In the latter a property containing the JVM parameter is defined, in the former it is empty, i.e. the JVM is started without the parameter. In Java 8 the parameter did not even exist, in Java 9+ we could use it, but we need to test how users use AspectJ. - RunSpec: Whenever an XML test is declared to use '<run>', we need to determine the current JVM version and again dynamically add the parameter when forking the target JVM. - AntSpec: Whenever an XML test is declared to use '<ant>', we need to determine the current JVM version dynamically add two properties usable from within Ant scripts: 'aj.addOpensKey' and 'aj.addOpensValue'. Unfortunately, Ant needs to use two '<argLine>' parameters, because the two parts of the option are separated by a space character. - Ant scripts: When triggered by an AntSpec, each Ant target using LTW needs to manually set <jvmarg value="${aj.addOpensKey}"/> <jvmarg value="${aj.addOpensValue}"/> for each '<java>' task. It was quite tedious to find all(?) of them. TODO: In the AspectJ 1.9.7 release notes we need to document that this parameter is now needed for LTW. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Fix AtAjLTWTests::testLTWDumpProxy for Java 16Alexander Kriegisch2021-03-231-2/+14
| | | | | | | | | | | | | | | Before Java 16, JDK proxies were given a virtual package name of 'com.sun.proxy'. Now the packages are numbered 'jdk.proxy[n]', i.e. 'jdk.proxy1', 'jdk.proxy2' etc. This makes the package-name-derived path name here less predictable. In our simple runtime scenario, we can be pretty sure than the counter starts at 1 because it is the first and only proxy we create. TODO: A better solution would be a recursive filtered search via Files.walk, ideally added as a recursive search option for CountingFilenameFilter. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Fix some deprecated Java and JUnit warnings by using newer API callsAlexander Kriegisch2021-03-213-3/+3
| | | | Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Add Java 16 test suite for AspectJ 1.9.7 + test refactoringsAlexander Kriegisch2021-03-217-69/+166
| | | | | | | | | | | | | | | - Test all features which were preview in 14+15 and are now final in 16, compiling them with language level 16. - For Java 15 we only have sanity tests (and of course the Java <14 tests), compiling Java 16 features to target 15 does not seem to work. - Test remaining Java 16 preview feature (sealed classes). - Instead of overriding runTest(String) in several base classes like XMLBasedAjcTestCaseForJava*Only or XMLBasedAjcTestCaseForJava*OrLater, we now override setUp() from JUnit's TestCase base class. This will run before runTest(String) and make the tests fail much faster, if a user tries to run them on the wrong VM. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Fix MultiProjectIncrementalTests.testInvalidAspectpath_pr121395Alexander Kriegisch2021-03-201-1/+8
| | | | | | | | | | | It failed with "RuntimeException: I never heard about what kind of build it was!!" on my (@kriegaex) Windows machine, mostly because in case of a failing full build the corresponding status is never set. TODO: Ensure that 'MyStateListener.informedAboutKindOfBuild' is set for failed builds, too. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Add Java 15 / AspectJ 1.9.7 test suiteAlexander Kriegisch2021-03-176-5/+221
| | | | | | Also fix some minor details in Java 14 suite Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Do not run tests using Java 14 preview features on this Java 15 compilerAlexander Kriegisch2021-03-171-0/+3
| | | | | | | | | | | | | | | | These tests need a Java 14 level AspectJ compiler, because they use version-specific preview features. This compiler has been upgraded to a Java 15 compliant JDT Core already, i.e. it does not support preview features of a previous version anymore. An error message similar to the above explanation will appear when trying to run any XMLBasedAjcTestCaseForJava14Only subclass, such as Ajc196PreviewFeaturesTests (currently the only one). When running AllTestsAspectJ196, Ajc196PreviewFeaturesTests will not be added to the test suite anymore. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Restructure Java 14 / AJ 1.9.6 testsAlexander Kriegisch2021-03-172-5/+6
| | | | | | | | - Java 14 feature sample classes moved from 'bugs' to 'features' - One test case using a Java 14 preview feature was moved to the Java 14-only tests Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Simplify execution of PureJavaTests and KnownLimitationsTestsAlexander Kriegisch2021-03-141-3/+3
| | | | | | | | | Getting rid of XML includes and two superfluous files, merging them with their respective including counterparts. As far as I can see, the two test suites are not part of the automatic build process, but can be started manually as easily as any other test (suite) now. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Make sure Java 14-only tests using preview are not executed on JVM 15+Alexander Kriegisch2021-03-143-53/+88
| | | | | | | | | | | Some Ajc196 tests are using preview features (see .../ajc196.xml), i.e. they will fail on Java 15+ because code compiled with '--enable-preview' can only run on the same JVM version, not on a more recent one. Hence, the preview-using tests are now being excluded in order to make the build run on Java 15, even though no Java 15 features are present in the current 1.9.7 snapshot. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Fix 'ajdoc' tests for Java 15 buildAlexander Kriegisch2021-03-144-150/+150
| | | | Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Fix MultiProjectIncrementalTests.testAspectPath_pr265693, 2nd tryAlexander Kriegisch2021-03-111-3/+7
| | | | | | | Do not assume a certain element order for tree nodes if there can be more than one. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Reduce test output for incremental comp testsAndy Clement2020-08-155-50/+60
|
* Merge branch 'master' into feature/collection-performanceAndy Clement2020-08-156-67/+59
|\
| * Reduce test output for incremental comp testsAndy Clement2020-08-155-49/+32
| |
| * Fix test on J14Andy Clement2020-08-151-18/+27
| |