]> source.dussan.org Git - aspectj.git/log
aspectj.git
19 months agoBump maven-javadoc-plugin from 3.2.0 to 3.5.0 dependabot/maven/org.apache.maven.plugins-maven-javadoc-plugin-3.5.0 235/head
dependabot[bot] [Tue, 11 Apr 2023 11:34:27 +0000 (11:34 +0000)]
Bump maven-javadoc-plugin from 3.2.0 to 3.5.0

Bumps [maven-javadoc-plugin](https://github.com/apache/maven-javadoc-plugin) from 3.2.0 to 3.5.0.
- [Release notes](https://github.com/apache/maven-javadoc-plugin/releases)
- [Commits](https://github.com/apache/maven-javadoc-plugin/compare/maven-javadoc-plugin-3.2.0...maven-javadoc-plugin-3.5.0)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-javadoc-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
20 months agoIDE.md: change 2022-12 AJDT M2E connector link to upstream update site
Alexander Kriegisch [Sat, 11 Mar 2023 12:23:54 +0000 (13:23 +0100)]
IDE.md: change 2022-12 AJDT M2E connector link to upstream update site

20 months agoAdded MIll to the Build tools section
Tobias Roeser [Fri, 20 May 2022 07:31:25 +0000 (09:31 +0200)]
Added MIll to the Build tools section

I'm the author of mill-aspectj and Mill maintainer, so i might be biased. ;-)

We use Mill with the mill-aspectj plugin in commercial projects, so I'm rather confident in it's reliability.

20 months agoJavaVersionCompatibility.md: add Java 19
Alexander Kriegisch [Wed, 1 Mar 2023 16:21:52 +0000 (17:21 +0100)]
JavaVersionCompatibility.md: add Java 19

20 months agoIDE.md: add link to m2e AJDT connector for Eclipse 2022-12
Alexander Kriegisch [Wed, 1 Mar 2023 07:33:36 +0000 (08:33 +0100)]
IDE.md: add link to m2e AJDT connector for Eclipse 2022-12

The link points to aspectj.dev for now, because Mika Vesti has not
merged my PR and published a new version on repo.t5.fi yet.

20 months agoIDE.md: Add new AJDT update site for 2022-12 (4.26)
Alexander Kriegisch [Tue, 28 Feb 2023 11:01:04 +0000 (12:01 +0100)]
IDE.md: Add new AJDT update site for 2022-12 (4.26)

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
20 months agoDepend on JDT Core 1.9.20.M1
Alexander Kriegisch [Tue, 28 Feb 2023 07:10:46 +0000 (08:10 +0100)]
Depend on JDT Core 1.9.20.M1

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
20 months agoHandleProviderDelimiter: rename JEM_MODULAR_CLASSFILE to MODULAR_CLASSFILE
Alexander Kriegisch [Tue, 28 Feb 2023 07:09:48 +0000 (08:09 +0100)]
HandleProviderDelimiter: rename JEM_MODULAR_CLASSFILE to MODULAR_CLASSFILE

The other constants do not have the JEM_ prefix from JavaElement either.

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
20 months agoSync HandleProviderDelimiter with JDT Core & AJDT
Alexander Kriegisch [Sat, 25 Feb 2023 22:11:05 +0000 (23:11 +0100)]
Sync HandleProviderDelimiter with JDT Core & AJDT

New constants:
  JEM_MODULAR_CLASSFILE - '\'' (single quote)
  ANNOTATION - '}'
  LAMBDA_EXPRESSION - ')'
  LAMBDA_METHOD - '&'
  STRING - '"'
  MODULE - '`'
  DELIMITER_ESCAPE - '='

Updated AspectJ constants due to JDT Core using constants previously
used by AspectJ:

  ADVICE - '&' to '§'
  ASPECT_TYPE - '\'' to '>'
  ITD_METHOD - ')' to '°'
  DECLARE - '`' to '´'
  POINTCUT - '"' to '©'

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
21 months agoAdd safeguards for And/Or/Not pattern node types
Alexander Kriegisch [Sun, 29 Jan 2023 16:14:05 +0000 (17:14 +0100)]
Add safeguards for And/Or/Not pattern node types

Affects *PointCut, *TypePattern, *AnnotationTypePattern.

Relates to #215.

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
21 months agoAdd traverse methods for declare and pattern types
Alexander Kriegisch [Sun, 29 Jan 2023 16:05:59 +0000 (17:05 +0100)]
Add traverse methods for declare and pattern types

Relates to #215.

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
21 months agoAdd traverse methods for pointcut types
Alexander Kriegisch [Sun, 29 Jan 2023 12:18:10 +0000 (13:18 +0100)]
Add traverse methods for pointcut types

Relates to #215.

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
21 months agoFurther improve indentation of compilation results on the console gh-217
Alexander Kriegisch [Tue, 24 Jan 2023 16:17:41 +0000 (17:17 +0100)]
Further improve indentation of compilation results on the console

In CompilationResult.toString, no longer indent like this:

  [warning 1] warning at
              after() : execution(FooBar Blah.*()) {
                                  ^^^^^^
              xxx FooBar [Xlint:invalidAbsoluteTypeName]

Instead, always just indent by 2 spaces, saving screen real estate:

  [warning 1] warning at
    after() : execution(FooBar Blah.*()) {
                        ^^^^^^
    xxx FooBar [Xlint:invalidAbsoluteTypeName]

Also further streamline/simplify the code a bit.

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
21 months agoFix indentation of compilation results on the console
Alexander Kriegisch [Sun, 22 Jan 2023 20:52:24 +0000 (21:52 +0100)]
Fix indentation of compilation results on the console

Whenever warnings or errors were printed via CompilationResult.toString,
indirectly also using MessageUtil.renderMessage(IMessage, boolean),
messages containing context info such as code snippets with carets
marking erroneous tokens - see also the previous commit - prefixes like
"[warning 1] warning at " were printed right in front of the code
snippets. I.e., the carets marking erroneous tokens in the second line
were not indented like the first line with the code snippet, leading to
(simplified) output like:

  [warning 1] warning at after() : execution(FooBar Blah.*()) {
                      ^^^^^^
  xxx FooBar [Xlint:invalidAbsoluteTypeName]

This was fixed to now correctly indent lines 2 to n according to line 1,
yielding the correct output:

  [warning 1] warning at
              after() : execution(FooBar Blah.*()) {
                                  ^^^^^^
              xxx FooBar [Xlint:invalidAbsoluteTypeName]

Especially with longer, more complex context lines, this helps to
identify the erroneous section. BTW, for one-line messages, everything
of course looks like before.

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
21 months agoBugfix: caret error marks in compiler output too short
Alexander Kriegisch [Sun, 22 Jan 2023 11:22:37 +0000 (12:22 +0100)]
Bugfix: caret error marks in compiler output too short

This very old bug in EclipseAdapterUtils calculated the '^' caret error
marks incorrectly. The marks were too short like this:

  void m() { return vax[3]; }
             ^^^^^^^^^^^

Where the correct result would look like this:

  void m() { return vax[3]; }
             ^^^^^^^^^^^^^^

This was due to the rather complicated way in which first surrounding
context code - here the leading 'void m() { ' and trailing  ' }' - was
first added and then possible leading white space was cut off again from
the left. It is difficult to explain, the code is a nightmare, trying to
work with char arrays, counting indexes, repeatedly using
System.arraycopy and using lots of counters and offsets. I would have
liked to simplify the code, converting char[] buffers to Strings, but
decided to keep the basic structure for now, not sure what kind of
memory or performance considerations led to this design.

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
22 months agoFix GitHub #214
Alexander Kriegisch [Sat, 21 Jan 2023 10:26:05 +0000 (11:26 +0100)]
Fix GitHub #214

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
22 months agoAdd regression test reproducing GitHub #214
Alexander Kriegisch [Sat, 21 Jan 2023 10:25:49 +0000 (11:25 +0100)]
Add regression test reproducing GitHub #214

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
22 months agoComment on newly pointcut parsing found problem in test class
Alexander Kriegisch [Sun, 15 Jan 2023 13:18:32 +0000 (14:18 +0100)]
Comment on newly pointcut parsing found problem in test class

A pointcut like

  execution(*..Collection<?>[] *(..))

leads to an AJ core dump, which is something I noticed while fixing a
test in the previous commit. I am going to create a new issue for it and
link to this commit later.

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
22 months agoFix failing tests after previous commit
Alexander Kriegisch [Sun, 15 Jan 2023 13:16:04 +0000 (14:16 +0100)]
Fix failing tests after previous commit

After the changes, the weaver's behaviour is now slightly different, but
not actually buggy. Actually, in one case there is now a weaver warning
for a non-matching pointcut which should have been there before, but was
not. I.e., things have improved and the tests are even a bit better now.

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
22 months agoRemove old, erroneously committed binaries from tests/bugs193/543657
Alexander Kriegisch [Sun, 15 Jan 2023 12:22:49 +0000 (13:22 +0100)]
Remove old, erroneously committed binaries from tests/bugs193/543657

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
22 months agoFix PointcutRewriterTest, add LogicalPointcutStructure test helper class
Alexander Kriegisch [Sun, 15 Jan 2023 00:25:11 +0000 (01:25 +0100)]
Fix PointcutRewriterTest, add LogicalPointcutStructure test helper class

After WildTypePattern.hashCode was fixed in the previous commit,
PointcutRewriterTest started failing, because in many places it was
falsely relying on a specific order of hash codes, which cannot be
guaranteed, especially since more instance fields are part of the hash
code now in accordance with 'equals'.

The new test helper class LogicalPointcutStructure is able to recognise
chained '&&' and '||' pointcuts of the same logical nesting level,
un-nesting them from the actual pointcut structure and making them
comparable, disregarding their order. I.e., something like
  ((A && B) && C) && D
is actually recognised to logically be
  A && B && C && D
and equivalent to e.g. either of
  D && B && A && C
  A && B && D && C
  C && A && D && B

This helps to compare rewritten pointcuts, as long as their logical
structure has not been altered.

Relates to #24.

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
22 months agoWildTypePattern: fix hashCode and toString methods
Alexander Kriegisch [Sun, 15 Jan 2023 00:16:24 +0000 (01:16 +0100)]
WildTypePattern: fix hashCode and toString methods

Especially 'hashCode' did not correspond to 'equals', disregarding
several fields, array dimension information being only one of them. This
led to parts of pointcuts being ignored, because they were regarded as
duplicates. Example:

execution(Foo* *(..)) && !execution(Foo*[] *(..))

Here, the negated pattern was falsely regarded as equal to the first
pattern, leading to an "A && !A" situation, i.e. no match at all.

Furthermore, 'toString' did not print array strings, i.e. instead of
"Foo*[][]" something like "Foo*" was printed. This false information was
also present in annotations generated by the weaver.

FuzzilyMatchingAspect was adjusted to actually match exactly once, as
expected, for the "Foo*" return types, i.e. exclusions for the array
return types have been added.

Relates to #24.

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
22 months agoImprove array matching for all TypePattern subclasses
Alexander Kriegisch [Sun, 15 Jan 2023 00:05:47 +0000 (01:05 +0100)]
Improve array matching for all TypePattern subclasses

Relates to #24.

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
22 months agoHandle one- and multi-dimensional array return types correctly
Alexander Kriegisch [Mon, 9 Jan 2023 17:03:50 +0000 (18:03 +0100)]
Handle one- and multi-dimensional array return types correctly

Fixes https://github.com/eclipse/org.aspectj/issues/24, both the array
return type matching as such as well as matching dimensionality patterns
correctly. E.g., 'Foo*[]' is not the same as 'Foo*[][]'. This also works
correctly in combination with asterisks, even for primitive types, i.e.
'in*[][]' correctly matches a 2-dimensional array of 'int'.

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
22 months agoSimplify if-else in WildTypePattern.matchesExactlyByName
Alexander Kriegisch [Mon, 9 Jan 2023 16:59:20 +0000 (17:59 +0100)]
Simplify if-else in WildTypePattern.matchesExactlyByName

A simple boolean condition is enough.

Loosely relates to https://github.com/eclipse/org.aspectj/issues/24, but
actually it is just drive-by cosmetics.

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
22 months agoFix WildTypePattern.isArray
Alexander Kriegisch [Mon, 9 Jan 2023 16:56:15 +0000 (17:56 +0100)]
Fix WildTypePattern.isArray

The method falsely determined that a one-dimensional array was not an
array due to a one-off bug.

Relates to https://github.com/eclipse/org.aspectj/issues/24.

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
22 months agoExpand regression tests for GitHub bug #24
Alexander Kriegisch [Mon, 9 Jan 2023 16:53:30 +0000 (17:53 +0100)]
Expand regression tests for GitHub bug #24

More test cases were added for
  - multi-dimensional arrays,
  - primitive type arrays.

Relates to https://github.com/eclipse/org.aspectj/issues/24.

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
22 months agoAdd regression tests for GitHub bug #24
Alexander Kriegisch [Sun, 8 Jan 2023 10:00:46 +0000 (11:00 +0100)]
Add regression tests for GitHub bug #24

Relates to https://github.com/eclipse/org.aspectj/issues/24.

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
22 months agoRefactor, comment and reactivate Ajc183Tests.testAnnoStyleDecp_442425
Alexander Kriegisch [Sat, 7 Jan 2023 13:23:26 +0000 (14:23 +0100)]
Refactor, comment and reactivate Ajc183Tests.testAnnoStyleDecp_442425

This test was always inactive and did not add any value other than
during development. No it runs, passes and documents the status quo of
  - what was fixed (regression for AJC 1.8.2 core dump fixed in 1.8.3),
  - the current limitations of @DeclareParents and @DeclareMixin
    regarding generic interfaces.

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
22 months agoRemove some old, accidentally committed class files from tests
Alexander Kriegisch [Sat, 7 Jan 2023 13:05:22 +0000 (14:05 +0100)]
Remove some old, accidentally committed class files from tests

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
22 months agoBcelTypeMunger.mungeMethodDelegate: only use 'synchronized' when necessary
Alexander Kriegisch [Sat, 7 Jan 2023 09:36:08 +0000 (10:36 +0100)]
BcelTypeMunger.mungeMethodDelegate: only use 'synchronized' when necessary

Relates to #198. Now, we create a delegate method body which basically
looks as follows:

public void methodOne() {
  if (this.ajc$instance$MyAspect$MyMixin == null) {
    synchronized(this) {
      if (this.ajc$instance$MyAspect$MyMixin == null) {
        this.ajc$instance$MyAspect$MyMixin = MyAspect.aspectOf().createImplementation(this);
      }
    }
  }
  this.ajc$instance$MyAspect$MyMixin.methodOne();
}

The idea for the outer null check is from @aclement, see
https://github.com/eclipse/org.aspectj/pull/205#issuecomment-1371556080.

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
22 months agoNo more compiler errors for implicitly static inner aspects of interfaces
Alexander Kriegisch [Fri, 6 Jan 2023 00:20:55 +0000 (01:20 +0100)]
No more compiler errors for implicitly static inner aspects of interfaces

Fixes #162. Contains regression test
Bugs1919Tests.testInterfaceInnerAspectImplicitlyStatic.

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
22 months agoTest cosmetics
Alexander Kriegisch [Fri, 6 Jan 2023 00:16:31 +0000 (01:16 +0100)]
Test cosmetics

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
22 months agoGitHub CI build: upgrade GabrielBB/xvfb-action to 1.6
Alexander Kriegisch [Wed, 4 Jan 2023 14:49:36 +0000 (15:49 +0100)]
GitHub CI build: upgrade GabrielBB/xvfb-action to 1.6

CI builds started showing warnings as follows:

Node.js 12 actions are deprecated. For more information see:
https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/.

Please update the following actions to use Node.js 16:
GabrielBB/xvfb-action@v1

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
22 months agoImprove BcelTypeMunger.mungeMethodDelegate to avoid race condition
Alexander Kriegisch [Thu, 29 Dec 2022 14:24:27 +0000 (15:24 +0100)]
Improve BcelTypeMunger.mungeMethodDelegate to avoid race condition

Fixes #198, i.e. test DeclareMixinTests.testCaseEConcurrent from the
previous commit now passes.

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
22 months agoAdd test reproducing problem from #198
Alexander Kriegisch [Thu, 29 Dec 2022 14:17:53 +0000 (15:17 +0100)]
Add test reproducing problem from #198

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
22 months agoFix parenthesised AJ keyword compiler problem
Alexander Kriegisch [Wed, 4 Jan 2023 13:55:42 +0000 (14:55 +0100)]
Fix parenthesised AJ keyword compiler problem

Fixes #20. Needs JDT Core grammar fix.

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
22 months agoFix TABLESWITCH weaver issue with Integer.MAX_VALUE
Alexander Kriegisch [Fri, 30 Dec 2022 08:55:23 +0000 (09:55 +0100)]
Fix TABLESWITCH weaver issue with Integer.MAX_VALUE

Fixes #190.

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
22 months agoRegression test for #190
Alexander Kriegisch [Fri, 30 Dec 2022 08:52:09 +0000 (09:52 +0100)]
Regression test for #190

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
22 months agoFix indentation in ajc1919.xml (cosmetics)
Alexander Kriegisch [Fri, 30 Dec 2022 08:49:19 +0000 (09:49 +0100)]
Fix indentation in ajc1919.xml (cosmetics)

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
22 months agoImprove code and documentation for #366085 fix
Alexander Kriegisch [Wed, 28 Dec 2022 10:54:28 +0000 (11:54 +0100)]
Improve code and documentation for #366085 fix

This commit is a follow-up for 65f1ec72. The SOURCE retention case is
documented now and considered in a few more call sites. The
previously already similar code structures in
  - DeclareAnnotation.ensureAnnotationDiscovered,
  - DeclareAnnotation.getAnnotationType
have both been streamlined and still remain logically in sync.

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
23 months agoIDE.md: update AJDT version info
Alexander Kriegisch [Thu, 22 Dec 2022 09:58:49 +0000 (10:58 +0100)]
IDE.md: update AJDT version info

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
23 months agoSet version to 1.9.20-SNAPSHOT
Alexander Kriegisch [Wed, 21 Dec 2022 15:53:32 +0000 (16:53 +0100)]
Set version to 1.9.20-SNAPSHOT

23 months agoAspectJ release 1.9.19 V1_9_19
Alexander Kriegisch [Wed, 21 Dec 2022 15:52:08 +0000 (16:52 +0100)]
AspectJ release 1.9.19

23 months agoBCEL: use MAX_CP_ENTRIES from internal class, not from JRE
Alexander Kriegisch [Wed, 21 Dec 2022 14:56:34 +0000 (15:56 +0100)]
BCEL: use MAX_CP_ENTRIES from internal class, not from JRE

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>
23 months agoBump JDT Core to release 1.9.19
Alexander Kriegisch [Wed, 21 Dec 2022 14:01:49 +0000 (15:01 +0100)]
Bump JDT Core to release 1.9.19

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
23 months agoUpdate release notes for 1.9.19 (Java 19)
Alexander Kriegisch [Wed, 21 Dec 2022 14:00:22 +0000 (15:00 +0100)]
Update release notes for 1.9.19 (Java 19)

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
23 months agoFix #366085 concerning declared annotations with source retention
Alexander Kriegisch [Sun, 4 Dec 2022 15:16:37 +0000 (16:16 +0100)]
Fix #366085 concerning declared annotations with source retention

See https://bugs.eclipse.org/bugs/show_bug.cgi?id=366085.
See https://stackoverflow.com/q/74618269/1082681.

The issue described in the Bugzilla issue is about 'declare @type', but
similar issues also existed for 'declare @field', 'declare @method',
'declare @constructor'. This fix is rather superficial and leaves
things to be desired, because it is rather hacky and simply ignores
errors source retention annotation declarations during weaving. A better
fix would drop the corresponding declarations while parsing and also
issue compiler warnings in each case.

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
23 months agoMerge pull request #187 from eclipse/java-19
Alexander Kriegisch [Wed, 21 Dec 2022 12:40:20 +0000 (19:40 +0700)]
Merge pull request #187 from eclipse/java-19

Java 19 support

23 months agoAdd release notes for 1.9.19 (Java 19) 187/head
Alexander Kriegisch [Wed, 21 Dec 2022 12:00:37 +0000 (13:00 +0100)]
Add release notes for 1.9.19 (Java 19)

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
23 months agoAdd tests for Java 19 record patterns
Alexander Kriegisch [Wed, 21 Dec 2022 11:57:44 +0000 (12:57 +0100)]
Add tests for Java 19 record patterns

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
23 months agoBump ECJ version in messages_aspectj.properties
Alexander Kriegisch [Tue, 20 Dec 2022 12:06:56 +0000 (13:06 +0100)]
Bump ECJ version in messages_aspectj.properties

Eclipse Compiler 19f448f47c9e3e (15Dec2022) - Java19

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
2 years agoMerge branch 'master' into java-19
Alexander Kriegisch [Sun, 13 Nov 2022 10:59:19 +0000 (11:59 +0100)]
Merge branch 'master' into java-19

2 years agoAddress upstream BCEL vulnerability CVE-2022-42920
Alexander Kriegisch [Sun, 13 Nov 2022 10:28:22 +0000 (11:28 +0100)]
Address upstream BCEL vulnerability CVE-2022-42920

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>
2 years agoOutputSpec.matchesThisVm better supports version ranges
Alexander Kriegisch [Wed, 5 Oct 2022 15:37:21 +0000 (17:37 +0200)]
OutputSpec.matchesThisVm better supports version ranges

vmVersionRanges might be a single version like "9", a list of versions
like "1.2,1.3,1.4,1.5", an equivalent range of "1.2-1.5", an open range
like "-1.8", "9-" (equivalent to "9+") or a more complex list of ranges
like "-1.6,9-11,13-14,17-" or "8,11,16+".

Empty ranges like in "", " ",  "8,,14", ",5", "6-," will be ignored.
I.e., they will not yield a positive match.

Bogus ranges like "9-11-14" will be ignored, too.

Existing XML test specs using '<line text="..." vm="v,v2,...,vn"/>
have been adjusted to use version ranges rather than long lists of
consecutive versions. Furthermore, ranges with a trailing '+' like '14+'
were replaced by using the new canonical format '14-', even though the
parser still correctly recognises '14+'.

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
2 years agoLangUtil: improve Java version major/minor parsing
Alexander Kriegisch [Wed, 5 Oct 2022 08:11:54 +0000 (10:11 +0200)]
LangUtil: improve Java version major/minor parsing

- Ignore everything including and after '+' in versions like '19+36-2238'
- Add minor '.0' to Java versions like '19', '19+36-2238'

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
2 years agoFix tests due to changed JDK 'toString' methods in Java 19
Alexander Kriegisch [Mon, 3 Oct 2022 19:51:31 +0000 (21:51 +0200)]
Fix tests due to changed JDK 'toString' methods in Java 19

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
2 years agoAdd the first few Java 19 tests
Alexander Kriegisch [Mon, 3 Oct 2022 15:17:50 +0000 (17:17 +0200)]
Add the first few Java 19 tests

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>
2 years agoDeactivate Java 18 preview language feature tests
Alexander Kriegisch [Mon, 3 Oct 2022 14:36:33 +0000 (16:36 +0200)]
Deactivate Java 18 preview language feature tests

and enable LangUtil to parse Java versions like '19+36-2238'.

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
2 years agoRemove Batik path entries from test classpath
Alexander Kriegisch [Mon, 3 Oct 2022 12:02:32 +0000 (14:02 +0200)]
Remove Batik path entries from test classpath

Firstly, Batik is not needed for running AspectJ tests.

Secondly, the fixed Windows path separators led to GitHub CI/CD tests
failing under Java 18+ on GitHub. Replacing ';' by 'File.pathSeparator'
would have fixed the problem, but removing the paths altogether is the
cleaner solution.

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
2 years agoCosmetic fixes in Java 18 tests (e.g. copyright year 2022)
Alexander Kriegisch [Mon, 3 Oct 2022 10:55:38 +0000 (12:55 +0200)]
Cosmetic fixes in Java 18 tests (e.g. copyright year 2022)

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
2 years agoDo not run Java 18 preview feature tests with Java 19 JDT Core
Alexander Kriegisch [Mon, 3 Oct 2022 10:53:33 +0000 (12:53 +0200)]
Do not run Java 18 preview feature tests with Java 19 JDT Core

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
2 years agoBump ASM to 9.4, supporting Java 20 class files
Alexander Kriegisch [Sun, 2 Oct 2022 15:38:27 +0000 (17:38 +0200)]
Bump ASM to 9.4, supporting Java 20 class files

Even though we just upgraded to 9.3 for Java 19, it does not hurt to
have ASM recognise the Java 20 class file major version.

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
2 years agoSet Maven version to 1.9.19-SNAPSHOT
Alexander Kriegisch [Sun, 2 Oct 2022 10:36:17 +0000 (12:36 +0200)]
Set Maven version to 1.9.19-SNAPSHOT

It makes sense to indicate the Java version in the minor-minor of
AspectJ artifacts.

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
2 years agoSet Java 19 compiler version after JDT Core merge
Alexander Kriegisch [Sun, 2 Oct 2022 10:11:43 +0000 (12:11 +0200)]
Set Java 19 compiler version after JDT Core merge

In messages_aspectj.properties, set compiler.version to
"Eclipse Compiler 5fd28398cc7aba (21Sep2022) - Java19".

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
2 years agoFirst Java 19 version, barely tested.
Alexander Kriegisch [Sat, 1 Oct 2022 15:51:45 +0000 (17:51 +0200)]
First Java 19 version, barely tested.

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
2 years agoAdd docs/dist/LICENSE-AspectJ.html to all public artifacts
Alexander Kriegisch [Sat, 1 Oct 2022 07:49:19 +0000 (09:49 +0200)]
Add docs/dist/LICENSE-AspectJ.html to all public artifacts

The license file will be included right in the main directory of both
binary and source artifacts for
  - AspectJ Matcher,
  - AspectJ Runtime,
  - AspectJ Weaver,
  - AspectJ Tools (Compiler),
  - AspectJ Installer.

Fixes #185.

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
2 years agovuln-fix: Partial Path Traversal Vulnerability
Jonathan Leitschuh [Fri, 9 Sep 2022 03:00:08 +0000 (03:00 +0000)]
vuln-fix: Partial Path Traversal Vulnerability

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>
2 years agoImprove condy (constant dynamic) support
Alexander Kriegisch [Sat, 13 Aug 2022 20:46:45 +0000 (22:46 +0200)]
Improve condy (constant dynamic) support

Relates to #170. Fixes the "Unknown constant type 17" problem.

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
2 years agoCI build: upgrade from Java 18-EA to 18
Alexander Kriegisch [Sun, 3 Jul 2022 08:39:24 +0000 (10:39 +0200)]
CI build: upgrade from Java 18-EA to 18

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
2 years agoUse System.lineSeparator() instead of hand-crafted method
Andrey Turbanov [Wed, 20 Apr 2022 20:20:22 +0000 (23:20 +0300)]
Use System.lineSeparator() instead of hand-crafted method

2 years agoMake IStateListener.aboutToCompareClasspaths use typed lists
Alexander Kriegisch [Mon, 18 Apr 2022 05:51:42 +0000 (12:51 +0700)]
Make IStateListener.aboutToCompareClasspaths use typed lists

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>
2 years agoCleanup redundant null check before instanceof
Andrey Turbanov [Sun, 17 Apr 2022 13:07:57 +0000 (16:07 +0300)]
Cleanup redundant null check before instanceof

2 years agoDo not use String literal as synchronized lock
Andrey Turbanov [Thu, 14 Apr 2022 07:33:48 +0000 (10:33 +0300)]
Do not use String literal as synchronized lock

2 years agoReduce 'Object' class usage
Andrey Turbanov [Wed, 13 Apr 2022 10:51:39 +0000 (13:51 +0300)]
Reduce 'Object' class usage

2 years agoFix suspicious Map.get call
Andrey Turbanov [Wed, 13 Apr 2022 09:56:23 +0000 (12:56 +0300)]
Fix suspicious Map.get call

2 years agoMerge pull request #155 from turbanoff/cleanup_redundant_casts
Andy Clement [Tue, 12 Apr 2022 15:27:46 +0000 (08:27 -0700)]
Merge pull request #155 from turbanoff/cleanup_redundant_casts

Remove redundant casts after generics update

2 years agoRemove redundant casts after generics update 155/head
Andrey Turbanov [Tue, 12 Apr 2022 08:22:29 +0000 (11:22 +0300)]
Remove redundant casts after generics update

2 years agoMerge pull request #131 from turbanoff/use_generics_ajdt.core
Andy Clement [Mon, 11 Apr 2022 21:17:43 +0000 (14:17 -0700)]
Merge pull request #131 from turbanoff/use_generics_ajdt.core

Update 'org.aspectj.ajdt.core' code to use generics

2 years agoBcelWorld.reportMatch: handle 'kind.getName() == null' correctly
Alexander Kriegisch [Sun, 10 Apr 2022 02:40:41 +0000 (09:40 +0700)]
BcelWorld.reportMatch: handle 'kind.getName() == null' correctly

Fixes #153.

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
2 years agoMake TypeSafeEnum immutable
Alexander Kriegisch [Sun, 10 Apr 2022 02:38:16 +0000 (09:38 +0700)]
Make TypeSafeEnum immutable

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
2 years agoJavaVersionCompatibility.md: add link to "Java language changes since Java 9"
Alexander Kriegisch [Sun, 10 Apr 2022 01:11:03 +0000 (08:11 +0700)]
JavaVersionCompatibility.md: add link to "Java language changes since Java 9"

https://docs.oracle.com/en/java/javase/18/language/java-language-changes.html
Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
2 years agoRemove obsolete comments in POM mentioning GitHub Packages
Alexander Kriegisch [Sun, 10 Apr 2022 01:09:35 +0000 (08:09 +0700)]
Remove obsolete comments in POM mentioning GitHub Packages

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
2 years agoMerge pull request #151 from eclipse/150-improve-ci-build
Alexander Kriegisch [Sat, 2 Apr 2022 05:38:17 +0000 (12:38 +0700)]
Merge pull request #151 from eclipse/150-improve-ci-build

Improve CI build: create docs, use Maven cache, attach artifacts

2 years agoCI build: attach main artifacts to build 151/head
Alexander Kriegisch [Sat, 2 Apr 2022 03:09:49 +0000 (10:09 +0700)]
CI build: attach main artifacts to build

Relates to #150.

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
2 years agoCI build: create docs and attach them to build
Alexander Kriegisch [Sat, 2 Apr 2022 03:09:08 +0000 (10:09 +0700)]
CI build: create docs and attach them to build

In order to create the docs separately, running just a single module,
add 'install' to the previous build step, so the 'docs' module can find
the 'lib' dummy JAR in the local Maven repo.

Relates to #150.

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
2 years agoCI build: use Maven cache
Alexander Kriegisch [Sat, 2 Apr 2022 03:07:34 +0000 (10:07 +0700)]
CI build: use Maven cache

Relates to #150.

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
2 years agoMerge pull request #149 from eclipse/148-remove-aspectj-browser
Alexander Kriegisch [Sat, 2 Apr 2022 02:58:16 +0000 (09:58 +0700)]
Merge pull request #149 from eclipse/148-remove-aspectj-browser

Remove AspectJ Browser

2 years agoRemove AspectJ Browser (ajbrowser) code and documentation 149/head
Alexander Kriegisch [Sat, 2 Apr 2022 01:22:42 +0000 (08:22 +0700)]
Remove AspectJ Browser (ajbrowser) code and documentation

Closes #148.

TODO: Should more AJDE stuff be removed?
Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
2 years agoDelete unused directories org.aspectj.lib, shadows.org.eclipse.jdt.core
Alexander Kriegisch [Fri, 1 Apr 2022 14:42:02 +0000 (21:42 +0700)]
Delete unused directories org.aspectj.lib, shadows.org.eclipse.jdt.core

I have not used those directories or any files inside them at all. I
hope I am not taking away anything helpful from people who prefer
working with inter-linked Eclipse projects instead of Maven, but I think
we will notice if anyone complains and can revert in case of an
emergency.

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
2 years agoRemove Aspectj.dev artifact and plugin repositories
Alexander Kriegisch [Fri, 1 Apr 2022 05:47:05 +0000 (12:47 +0700)]
Remove Aspectj.dev artifact and plugin repositories

After having removed the custom-built Maven Shade version, there should
be no more references to artifacts in that repository left. Let us see
if the build passes.

Furthermore, since being a committer, I can also attach AspectJ
installers to GitHub releases.

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
2 years agoBump Maven Shade Plugin to 3.3.0, add TODO to remove Flatten Maven Plugin
Alexander Kriegisch [Fri, 1 Apr 2022 05:42:36 +0000 (12:42 +0700)]
Bump Maven Shade Plugin to 3.3.0, add TODO to remove Flatten Maven Plugin

Fixed issues of concern include MSHADE-252, MSHADE-396, MSHADE-391.
TODO: MSHADE-36 is in Maven Shade 3.3.0 -> it should be possible to
include the dependency-reduced POM there directly. So maybe, we can rid
of Flatten Maven Plugin.

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
2 years agoSet version to 1.9.10-SNAPSHOT
Alexander Kriegisch [Thu, 31 Mar 2022 12:11:46 +0000 (19:11 +0700)]
Set version to 1.9.10-SNAPSHOT

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
2 years agoRelease AspectJ version 1.9.9.1 V1_9_9_1
Alexander Kriegisch [Thu, 31 Mar 2022 12:09:44 +0000 (19:09 +0700)]
Release AspectJ version 1.9.9.1

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
2 years agoBump JDT Core to 1.9.9.1
Alexander Kriegisch [Thu, 31 Mar 2022 11:48:34 +0000 (18:48 +0700)]
Bump JDT Core to 1.9.9.1

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
2 years agoAdd AspectJ 1.9.9.1 delta to existing 1.9.9 release notes
Alexander Kriegisch [Thu, 31 Mar 2022 11:24:00 +0000 (18:24 +0700)]
Add AspectJ 1.9.9.1 delta to existing 1.9.9 release notes

The minor release from a user perspective is just going to be about

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
#145, so we are not creating an extra release notes document.

2 years agoUseJDKExtendedCharsets.java: add "how to fix test" comment
Alexander Kriegisch [Thu, 31 Mar 2022 08:21:13 +0000 (15:21 +0700)]
UseJDKExtendedCharsets.java: add "how to fix test" comment

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
2 years agoMerge pull request #147 from kriegaex/revert-full-ltw-java18
Alexander Kriegisch [Thu, 31 Mar 2022 08:09:12 +0000 (15:09 +0700)]
Merge pull request #147 from kriegaex/revert-full-ltw-java18

Fix JDK-version-dependent test JVM arguments in POM

2 years agoRevert "Fix more LTW tests" 147/head
Alexander Kriegisch [Thu, 31 Mar 2022 07:24:03 +0000 (14:24 +0700)]
Revert "Fix more LTW tests"

This reverts commit 63d5e3e893bd149245465de1610716930998dec8.

2 years agoRevert "AtAjLTWTests: 4 test cases switched to 'useFullLTW' mode"
Alexander Kriegisch [Thu, 31 Mar 2022 05:54:08 +0000 (12:54 +0700)]
Revert "AtAjLTWTests: 4 test cases switched to 'useFullLTW' mode"

This reverts commit 5288ef1c1c8be2df85e59740f41622f4cfb9d899.