aboutsummaryrefslogtreecommitdiffstats
path: root/bcel-builder/src
Commit message (Collapse)AuthorAgeFilesLines
* Add test infrastructure for Java 21 (WIP)Alexander Kriegisch2023-10-051-2/+4
| | | | | | | The tests and their XML definitions are still copy & paste and need to be cleaned up. Separate Java 21 feature tests do not exist yet. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Improve Java 9+ version matching in ClassPath.getClassPathAlexander Kriegisch2023-06-241-2/+2
| | | | | | | | On the short term, this fixes the failing weaver tests on JDK 20. On the long term, the improved matching heuristics should make it unnecessary to update the regex again. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Add basic tests for Java 20, deactivate Java 19 preview testsAlexander Kriegisch2023-06-241-2/+4
| | | | Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Fix TABLESWITCH weaver issue with Integer.MAX_VALUEAlexander Kriegisch2022-12-301-2/+2
| | | | | | Fixes #190. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* BCEL: use MAX_CP_ENTRIES from internal class, not from JREAlexander Kriegisch2022-12-211-5/+4
| | | | | | | | | | | | Instead of importing com.sun.org.apache.bcel.internal.Const, use use org.aspectj.apache.bcel.Constants. The former class is from the internal JRE module 'java.xml' which is not exposed by default. Actually, no existing test failed because of it, but javadoc generation for the AspectJ weaver. Relates to #192. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Merge branch 'master' into java-19Alexander Kriegisch2022-11-131-4/+21
|\
| * Address upstream BCEL vulnerability CVE-2022-42920Alexander Kriegisch2022-11-131-4/+21
| | | | | | | | | | | | | | | | | | | | Fixes #192. See https://github.com/advisories/GHSA-97xg-phpr-rg8q. See https://issues.apache.org/jira/browse/BCEL-363. See https://github.com/apache/commons-bcel/pull/147. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* | Add the first few Java 19 testsAlexander Kriegisch2022-10-031-2/+4
|/ | | | | | | | | | For now, only the "pattern matching for switch" tests from previews 1 and 2 were adjusted to work in preview 3, because guarded patterns were replaced by 'when' clauses in 'switch' blocks. Therefore, existing test classes did not compile anymore and had to be replaced by syntactically upgraded versions with content merged from preview 1 and 2 classes. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Improve condy (constant dynamic) supportAlexander Kriegisch2022-08-132-2/+22
| | | | | | Relates to #170. Fixes the "Unknown constant type 17" problem. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Remove redundant casts after generics updateAndrey Turbanov2022-04-121-2/+2
|
* Prepare code, tests and docs for Java 18Alexander Kriegisch2022-03-211-2/+4
| | | | | | | | | | | | | | | | | | | | - 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>
* Couple of basic tests for the repository optimizationsAndy Clement2022-01-132-16/+105
|
* Optimize class loading - make backward compatible with legacy behaviourAlexander Kriegisch2022-01-131-3/+5
| | | | | | | | | | | | | | | | | | Now the defaults are: + org.aspectj.apache.bcel.useSingleRepositoryInstance (default: false) + org.aspectj.apache.bcel.useUnavailableClassesCache (default: false) + org.aspectj.apache.bcel.ignoreCacheClearRequests (default: false) I.e. the new caching optimisations are opt-in instead of opt-out as originally designed. This might change in the future, but for now without any additional tests and experience with the new feature let us be conservative and make the build green first. I also added a few more code review findings concerning backward compatibility, which was less than 100% even with all three flags deactivated. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Optimize class loadingStefan Starke2022-01-131-7/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | In our project we found out that during the build up of the spring context the class loading takes a very long time. Root cause is the huge amount of file I/O during pointcut class loading. We are taking about ~250k file loads. With these changes we managed to cut down the starting time by around 50%. What we found out is that IMHO - the clear method of the ClassLoaderRepository is called far too often -> in our settings this resulted in not a single cache hit as the cache got cleared permanently. Therefore we de-actived the cache clear calls inside the ClassLoaderRepository. Secondly we changed the Java15AnnotationFinder in a way to not always create new objects for the ClassLoaderRepository but re-use one static instance. Otherwise we experienced >100k objects being created. Last but not least we introduced a cache for unavailable classes so that they do not have to be looked up using file I/O over and over again. The whole behavior is configurable via + org.aspectj.apache.bcel.useSingleRepositoryInstance (default: true) + org.aspectj.apache.bcel.useUnavailableClassesCache (default: true) + org.aspectj.apache.bcel.ignoreCacheClearRequests (default: true) Signed-off-by: Stefan Starke <stefan@starkeweb.org> Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Merge pull request #109 from turbanoff/avoid_empty_arrays_allocationAndy Clement2022-01-105-12/+9
|\ | | | | Reduce empty array allocations
| * Reduce empty array allocationsAndrey Turbanov2021-12-185-12/+9
| |
* | Fix ConstantDynamic to use the right tag.Andy Clement2022-01-061-1/+1
|/ | | | | | | | | | The class ConstantDynamic was incorrectly using the `InvokeDynamic` tag during construction which meant after reading in code containing a `Dynamic` reference, it would incorrectly be written out as an `InvokeDynamic` reference. There is not much code out there using Dynamic so wasn't uncovered before. Fixes #68
* Replace more usages of StringBuffer with StringBuilderAndrey Turbanov2021-12-052-6/+6
|
* Merge pull request #102 from turbanoff/trim_trailing_whitespacesAndy Clement2021-11-3072-278/+278
|\ | | | | Trim trailing whitespaces.
| * Trim trailing whitespaces.Andrey Turbanov2021-11-2099-460/+460
| | | | | | | | | | 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-3037-245/+245
|\ \ | | | | | | Replace uses of StringBuffer with StringBuilder.
| * | Replace uses of StringBuffer with StringBuilder.Andrey Turbanov2021-11-2037-245/+245
| |/ | | | | | | StringBuffer is a legacy synchronized class. StringBuilder is a direct replacement to StringBuffer which generally have better performance.
* / According to javadoc File.isDirectory 'true' if and only if the file denoted ↵Andrey Turbanov2021-11-201-4/+4
|/ | | | | | by this abstract pathname exists and is a directory. It means that separate File.exists() check before File.isDirectory() check is redundant.
* Merge pull request #77 from SmallGiantGames/bug415838-testAndy Clement2021-06-302-1/+108
|\ | | | | Test for 1.9.6 concurrency bug in LocalVariableTable.unpack()
| * minor improvementsDmitry Mikhaylov2021-06-292-21/+29
| |
| * test for failing synchronization in LocalVariableTable.unpackDmitry Mikhaylov2021-06-282-5/+104
| |
* | Add AspectJ 1.9.7 and Java 17 test skeletonsAlexander Kriegisch2021-06-261-2/+4
| | | | | | | | Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* | Merge pull request #64 from SmallGiantGames/bug415838Andy Clement2021-06-241-7/+7
|\ \ | | | | | | add synchronization to LocalVariableTable
| * | add synchronization to LocalVariableTableDmitry Mikhaylov2021-05-311-7/+7
| |/
* / Upgrade license from CPLv1/EPLv1 to EPLv2Alexander Kriegisch2021-06-0449-837/+837
|/ | | | | | | This was required by the Eclipse team as one precondition for the next release. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Make BCEL classpath utility recognise Java 16-19, fixing many testsAlexander Kriegisch2021-03-211-1/+1
| | | | | | | | | | | | | | | | | This is a follow-up commit on @07af5d41: Inside org.aspectj.apache.bcel.util.ClassPath.getClassPath(), some JVM version matching occurs which previously did not include Java 16 (I also added 17-19 to the regex matcher). This fixes test errors like: java.lang.ClassCastException: class org.aspectj.weaver.MissingResolvedTypeWithKnownSignature cannot be cast to class org.aspectj.weaver.ReferenceType (org.aspectj.weaver.MissingResolvedTypeWithKnownSignature and org.aspectj.weaver.ReferenceType are in unnamed module of loader 'app') Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Fix some deprecated Java and JUnit warnings by using newer API callsAlexander Kriegisch2021-03-212-8/+8
| | | | Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Add Java 16 test suite for AspectJ 1.9.7 + test refactoringsAlexander Kriegisch2021-03-211-2/+2
| | | | | | | | | | | | | | | - 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>
* Add Java 15 class vile version to BCEL constants, adjust test tools etc.Alexander Kriegisch2021-03-161-0/+6
| | | | Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Make BCEL classpath utility recognise Java 15, fixing many testsAlexander Kriegisch2021-03-131-5/+1
| | | | | | | | | | | | | | | | | | | | Inside org.aspectj.apache.bcel.util.ClassPath.getClassPath(), some JVM version matching occurs which previously did not include Java 15. Technically, AspectJ 1.9.6 does not support Java 15, but on GitHub Actions there is a build job running on a JVM 15. This change should at least make the weaver tests pass, making that test job more meaningful. This fixes test errors like java.lang.ClassCastException: class org.aspectj.weaver.MissingResolvedTypeWithKnownSignature cannot be cast to class org.aspectj.weaver.ReferenceType (org.aspectj.weaver.MissingResolvedTypeWithKnownSignature and org.aspectj.weaver.ReferenceType are in unnamed module of loader 'app') Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
* Remove unnecessary interface modifiersLars Grefer2020-08-1711-870/+870
| | | | Signed-off-by: Lars Grefer <eclipse@larsgrefer.de>
* polishAndy Clement2020-08-166-7/+23
|
* Merge branch 'master' into feature/collection-performanceAndy Clement2020-08-159-9/+0
|\
| * Cleanup unused importsLars Grefer2020-08-1610-10/+0
| | | | | | | | Signed-off-by: Lars Grefer <eclipse@larsgrefer.de>
* | Weaken Collection declarationsLars Grefer2020-08-156-27/+17
| | | | | | | | | | | | Reports on declarations of Collection variables made by using the collection class as the type, rather than an appropriate interface. Signed-off-by: Lars Grefer <eclipse@larsgrefer.de>
* | Redundant Collection.addAll() callLars Grefer2020-08-151-2/+1
| | | | | | | | | | | | Reports Collection.addAll() and Map.putAll() calls after instantiation of a collection using a constructor call without arguments. Such constructs can be replaced with a single call to a parametrized constructor which simplifies code. Also for some collections the replacement might be more performant. Signed-off-by: Lars Grefer <eclipse@larsgrefer.de>
* | Collection.toArray() call styleLars Grefer2020-08-152-2/+2
| | | | | | | | | | | | | | There are two styles to convert a collection to an array: either using a pre-sized array (like c.toArray(new String[c.size()])) or using an empty array (like c.toArray(new String[0]). In older Java versions using pre-sized array was recommended, as the reflection call which is necessary to create an array of proper size was quite slow. However since late updates of OpenJDK 6 this call was intrinsified, making the performance of the empty array version the same and sometimes even better, compared to the pre-sized version. Also passing pre-sized array is dangerous for a concurrent or synchronized collection as a data race is possible between the size and toArray call which may result in extra nulls at the end of the array, if the collection was concurrently shrunk during the operation. Signed-off-by: Lars Grefer <eclipse@larsgrefer.de>
* | Single Map method can be usedLars Grefer2020-08-151-5/+1
| | | | | | | | | | | | Reports common usage patterns of java.util.Map that could be replaced with Java 8 methods: getOrDefault(), computeIfAbsent(), putIfAbsent(), merge(), or replaceAll(). Signed-off-by: Lars Grefer <eclipse@larsgrefer.de>
* | Collections.sort() can be replaced with List.sort()Lars Grefer2020-08-151-3/+3
| | | | | | | | | | | | Reports calls to Collections.sort(list, comparator) which could be replaced with list.sort(comparator). Signed-off-by: Lars Grefer <eclipse@larsgrefer.de>
* | Manual array to collection copyLars Grefer2020-08-151-9/+2
|/ | | | | | Reports the copying of array contents to a collection where each element is added individually using a for loop. Such constructs may be replaced by a call to Collection.addAll(Arrays.asList()) or Collections.addAll(). Signed-off-by: Lars Grefer <eclipse@larsgrefer.de>
* Use the diamond operator where possibleLars Grefer2020-08-1325-73/+73
| | | | Signed-off-by: Lars Grefer <eclipse@larsgrefer.de>
* Unnecessary unboxingLars Grefer2020-08-082-6/+6
| | | | | | Reports "unboxing", e.g. explicit unwrapping of wrapped primitive values. Unboxing is unnecessary under Java 5 and newer, and can be safely removed. Signed-off-by: Lars Grefer <eclipse@larsgrefer.de>
* Unnecessary boxingLars Grefer2020-08-082-3/+3
| | | | | | Reports explicit boxing, i.e. wrapping of primitive values in objects. Explicit manual boxing is unnecessary under Java 5 and newer, and can be safely removed. Signed-off-by: Lars Grefer <eclipse@larsgrefer.de>
* 'String.indexOf()' expression is replaceable with 'contains()'Lars Grefer2020-08-085-9/+9
| | | | | | Reports any String.indexOf() expressions which can be replaced with a call to the String.contains() method available in Java 5 and newer. Signed-off-by: Lars Grefer <eclipse@larsgrefer.de>
* 'while' loop replaceable with enhanced 'for' loopLars Grefer2020-08-081-3/+1
| | | | | | Reports while loops which iterate over collections, and can be replaced with an enhanced for loop (i.e. foreach iteration syntax). Signed-off-by: Lars Grefer <eclipse@larsgrefer.de>