eclipse-aspectj / aspectj

Other
303 stars 86 forks source link

`ajc` fails when aspect is annotated with `@Deprecated` #316

Open lefou opened 4 months ago

lefou commented 4 months ago

I added a @Deprecated annotation to an aspect and saw the following compiler error. Once I removed the annotation, the aspect compiles again.

mill module.kernel.compile
[355/355] module.kernel.compile 
Compiling 279 Java sources and 4 AspectJ sources to /home/lefou/work/tototec/iba/2017-Comfis/comfis/out/module/kernel/compile.dest ...
<Unknown> [warning] Found @DeclareAnnotation while current release does not support it (see 'org.aspectj.weaver.bcel.AtAjAttributes')

/home/lefou/work/tototec/iba/2017-Comfis/comfis/module/kernel/src/de/ibacg/cmfs/aspects/AbstractAccessRightsAspect.aj [error] Internal compiler error: java.lang.NullPointerException: Cannot invoke "org.aspectj.org.eclipse.jdt.internal.compiler.lookup.AnnotationBinding.getAnnotationType()" because "annotationBinding" is null at org.aspectj.org.eclipse.jdt.internal.compiler.problem.ProblemReporter.deprecatedSinceValue(ProblemReporter.java:2033)
(no source information available)
ABORT

Exception thrown from AspectJ 1.9.22

This might be logged as a bug already -- find current bugs at
  https://bugs.eclipse.org/bugs/buglist.cgi?product=AspectJ&component=Compiler

Bugs for exceptions thrown have titles File:line from the top stack, 
e.g., "SomeFile.java:243"

If you don't find the exception below in a bug, please add a new bug
at https://bugs.eclipse.org/bugs/enter_bug.cgi?product=AspectJ
To make the bug a priority, please include a test program
that can reproduce this exception.
Cannot invoke "org.aspectj.org.eclipse.jdt.internal.compiler.lookup.AnnotationBinding.getAnnotationType()" because "annotationBinding" is null

when batch building BuildConfig[null] #Files=283 AopXmls=#0
Cannot invoke "org.aspectj.org.eclipse.jdt.internal.compiler.lookup.AnnotationBinding.getAnnotationType()" because "annotationBinding" is null
java.lang.NullPointerException: Cannot invoke "org.aspectj.org.eclipse.jdt.internal.compiler.lookup.AnnotationBinding.getAnnotationType()" because "annotationBinding" is null
        at org.aspectj.org.eclipse.jdt.internal.compiler.problem.ProblemReporter.deprecatedSinceValue(ProblemReporter.java:2033)
        at org.aspectj.org.eclipse.jdt.internal.compiler.problem.ProblemReporter.deprecatedType(ProblemReporter.java:1992)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeReference.reportDeprecatedType(TypeReference.java:601)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeReference.internalResolveType(TypeReference.java:562)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:637)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:633)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.ClassLiteralAccess.resolveType(ClassLiteralAccess.java:86)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.MessageSend.resolveType(MessageSend.java:906)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.MessageSend.resolveType(MessageSend.java:855)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.Assignment.resolveType(Assignment.java:227)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.Expression.resolve(Expression.java:1118)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.Statement.resolveWithBindings(Statement.java:498)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.ASTNode.resolveStatements(ASTNode.java:726)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.Block.resolve(Block.java:128)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.Statement.resolveWithBindings(Statement.java:498)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.IfStatement.resolve(IfStatement.java:311)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.Statement.resolveWithBindings(Statement.java:498)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.ASTNode.resolveStatements(ASTNode.java:726)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.Block.resolve(Block.java:128)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.Statement.resolveWithBindings(Statement.java:498)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.IfStatement.resolve(IfStatement.java:311)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.Statement.resolveWithBindings(Statement.java:498)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.ASTNode.resolveStatements(ASTNode.java:726)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatements(AbstractMethodDeclaration.java:720)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatements(MethodDeclaration.java:410)
        at org.aspectj.ajdt.internal.compiler.ast.AdviceDeclaration.resolveStatements(AdviceDeclaration.java:132)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:618)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1541)
        at org.aspectj.ajdt.internal.compiler.ast.AspectDeclaration.resolve(AspectDeclaration.java:116)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1670)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:666)
        at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:919)
        at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.processCompiledUnits(Compiler.java:575)
        at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:475)
        at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:426)
        at org.aspectj.ajdt.internal.core.builder.AjBuildManager.performCompilation(AjBuildManager.java:1101)
        at org.aspectj.ajdt.internal.core.builder.AjBuildManager.performBuild(AjBuildManager.java:275)
        at org.aspectj.ajdt.internal.core.builder.AjBuildManager.batchBuild(AjBuildManager.java:188)
        at org.aspectj.ajdt.ajc.AjdtCommand.doCommand(AjdtCommand.java:103)
        at org.aspectj.ajdt.ajc.AjdtCommand.runCommand(AjdtCommand.java:47)
        at org.aspectj.tools.ajc.Main.run(Main.java:385)
        at org.aspectj.tools.ajc.Main.runMain(Main.java:274)
        at de.tobiasroeser.mill.aspectj.worker.impl.AspectjInJvmWorker.internalCompile(AspectjInJvmWorker.scala:79)
        at de.tobiasroeser.mill.aspectj.worker.impl.AspectjInJvmWorker.compile(AspectjInJvmWorker.scala:26)
        at de.tobiasroeser.mill.aspectj.AspectjModule.$anonfun$ajcTask$1(AspectjModule.scala:145)
        at mill.define.Task$TraverseCtx.evaluate(Task.scala:71)
        at mill.eval.GroupEvaluator.$anonfun$evaluateGroup$11(GroupEvaluator.scala:356)
        at scala.util.DynamicVariable.withValue(DynamicVariable.scala:59)
        at scala.Console$.withErr(Console.scala:193)
        at mill.api.SystemStreams$.$anonfun$withStreams$2(SystemStreams.scala:62)
        at scala.util.DynamicVariable.withValue(DynamicVariable.scala:59)
        at scala.Console$.withOut(Console.scala:164)
        at mill.api.SystemStreams$.$anonfun$withStreams$1(SystemStreams.scala:61)
        at scala.util.DynamicVariable.withValue(DynamicVariable.scala:59)
        at scala.Console$.withIn(Console.scala:227)
        at mill.api.SystemStreams$.withStreams(SystemStreams.scala:60)
        at mill.eval.GroupEvaluator.$anonfun$evaluateGroup$8(GroupEvaluator.scala:356)
        at mill.eval.GroupEvaluator.$anonfun$evaluateGroup$8$adapted(GroupEvaluator.scala:325)
        at scala.collection.immutable.Vector.foreach(Vector.scala:2124)
        at mill.eval.GroupEvaluator.computeAll$1(GroupEvaluator.scala:325)
        at mill.eval.GroupEvaluator.evaluateGroup(GroupEvaluator.scala:380)
        at mill.eval.GroupEvaluator.$anonfun$evaluateGroupCached$22(GroupEvaluator.scala:247)
        at scala.util.DynamicVariable.withValue(DynamicVariable.scala:59)
        at mill.eval.GroupEvaluator.$anonfun$evaluateGroupCached$2(GroupEvaluator.scala:238)
        at mill.eval.GroupEvaluator$synchronizedEval$.$anonfun$apply$1(GroupEvaluator.scala:65)
        at scala.util.Using$.resource(Using.scala:296)
        at mill.eval.GroupEvaluator$synchronizedEval$.apply(GroupEvaluator.scala:64)
        at mill.eval.GroupEvaluator.evaluateGroupCached(GroupEvaluator.scala:83)
        at mill.eval.GroupEvaluator.evaluateGroupCached$(GroupEvaluator.scala:71)
        at mill.eval.EvaluatorImpl.evaluateGroupCached(EvaluatorImpl.scala:15)
        at mill.eval.EvaluatorCore.$anonfun$evaluate0$2(EvaluatorCore.scala:116)
        at scala.concurrent.impl.Promise$Transformation.run(Promise.scala:467)
        at mill.eval.ExecutionContexts$RunNow$.execute(ExecutionContexts.scala:14)
        at scala.concurrent.impl.Promise$Transformation.submitWithValue(Promise.scala:429)
        at scala.concurrent.impl.Promise$DefaultPromise.submitWithValue(Promise.scala:338)
        at scala.concurrent.impl.Promise$DefaultPromise.dispatchOrAddCallbacks(Promise.scala:312)
        at scala.concurrent.impl.Promise$DefaultPromise.map(Promise.scala:182)
        at mill.eval.EvaluatorCore.$anonfun$evaluate0$1(EvaluatorCore.scala:92)
        at mill.eval.EvaluatorCore.$anonfun$evaluate0$1$adapted(EvaluatorCore.scala:90)
        at scala.collection.immutable.Vector.foreach(Vector.scala:2124)
        at mill.eval.EvaluatorCore.evaluate0(EvaluatorCore.scala:90)
        at mill.eval.EvaluatorCore.$anonfun$evaluate$1(EvaluatorCore.scala:43)
        at scala.util.DynamicVariable.withValue(DynamicVariable.scala:59)
        at mill.eval.EvaluatorCore.evaluate(EvaluatorCore.scala:34)
        at mill.eval.EvaluatorCore.evaluate$(EvaluatorCore.scala:26)
        at mill.eval.EvaluatorImpl.evaluate(EvaluatorImpl.scala:15)
        at mill.main.RunScript$.evaluateNamed(RunScript.scala:38)
        at mill.main.RunScript$.$anonfun$evaluateTasksNamed$2(RunScript.scala:26)
        at scala.util.Either.map(Either.scala:390)
        at mill.main.RunScript$.evaluateTasksNamed(RunScript.scala:26)
        at mill.runner.MillBuildBootstrap$.evaluateWithWatches(MillBuildBootstrap.scala:399)
        at mill.runner.MillBuildBootstrap.$anonfun$processFinalTargets$3(MillBuildBootstrap.scala:308)
        at scala.util.DynamicVariable.withValue(DynamicVariable.scala:59)
        at mill.runner.MillBuildBootstrap.processFinalTargets(MillBuildBootstrap.scala:308)
        at mill.runner.MillBuildBootstrap.evaluateRec(MillBuildBootstrap.scala:196)
        at mill.runner.MillBuildBootstrap.$anonfun$evaluate$1(MillBuildBootstrap.scala:49)
        at scala.util.DynamicVariable.withValue(DynamicVariable.scala:59)

Juli 26, 2024 11:07:44 AM org.aspectj.weaver.tools.Jdk14Trace info
INFORMATION: Dumping to /home/lefou/work/tototec/iba/2017-Comfis/comfis/./ajcore.20240726.110744.754.txt

1 fail|abort, 1 error, 1 warning
lefou commented 4 months ago

Same with AspectJ 1.9.22.1.

kriegaex commented 4 months ago

Cannot reproduce. Please provide an MCVE. As you know, I do not use Mill, so please either a batch file for compiling and running the code or, ideally, a Maven project.

lefou commented 4 months ago

So, this is likely some strange referencing issue, but here are the minimized source files:

// example/AbstractAccessRightsAspect.aj
package example;

/**
 * @deprecated Use {@link AccessRightsHelper} instead.
 */
public abstract aspect AbstractAccessRightsAspect {
}
// example/AccessRightsAspect.aj
package example;

@Deprecated
public aspect AccessRightsAspect extends AbstractAccessRightsAspect {
}
// example/AccessRightsHelper.java
package example;

public class AccessRightsHelper {
    public void dump () {
        System.err.println("Replacing Aspect: "+ AccessRightsAspect.aspectOf());
    }
}

Compilation fails with:

> mill module.kernel.compile
[357/357] module.kernel.compile 
Compiling 2 Java sources and 2 AspectJ sources to /home/lefou/work/tototec/iba/2017-Comfis/comfis/repro-ajc-deprecated/out/module/kernel/compile.dest ...
<Unknown> [warning] Found @DeclareAnnotation while current release does not support it (see 'org.aspectj.weaver.bcel.AtAjAttributes')

/home/lefou/work/tototec/iba/2017-Comfis/comfis/repro-ajc-deprecated/module/kernel/src/example/AccessRightsHelper.java [error] Internal compiler error: java.lang.NullPointerException: Cannot invoke "org.aspectj.org.eclipse.jdt.internal.compiler.lookup.AnnotationBinding.getAnnotationType()" because "annotationBinding" is null at org.aspectj.org.eclipse.jdt.internal.compiler.problem.ProblemReporter.deprecatedSinceValue(ProblemReporter.java:2033)
(no source information available)
ABORT

Exception thrown from AspectJ 1.9.22.1

This might be logged as a bug already -- find current bugs at
  https://bugs.eclipse.org/bugs/buglist.cgi?product=AspectJ&component=Compiler

Bugs for exceptions thrown have titles File:line from the top stack, 
e.g., "SomeFile.java:243"

If you don't find the exception below in a bug, please add a new bug
at https://bugs.eclipse.org/bugs/enter_bug.cgi?product=AspectJ
To make the bug a priority, please include a test program
that can reproduce this exception.
Cannot invoke "org.aspectj.org.eclipse.jdt.internal.compiler.lookup.AnnotationBinding.getAnnotationType()" because "annotationBinding" is null

when batch building BuildConfig[null] #Files=4 AopXmls=#0
Cannot invoke "org.aspectj.org.eclipse.jdt.internal.compiler.lookup.AnnotationBinding.getAnnotationType()" because "annotationBinding" is null
java.lang.NullPointerException: Cannot invoke "org.aspectj.org.eclipse.jdt.internal.compiler.lookup.AnnotationBinding.getAnnotationType()" because "annotationBinding" is null
        at org.aspectj.org.eclipse.jdt.internal.compiler.problem.ProblemReporter.deprecatedSinceValue(ProblemReporter.java:2033)
        at org.aspectj.org.eclipse.jdt.internal.compiler.problem.ProblemReporter.deprecatedType(ProblemReporter.java:1992)
        at org.aspectj.org.eclipse.jdt.internal.compiler.problem.ProblemReporter.deprecatedType(ProblemReporter.java:1976)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.SingleNameReference.resolveType(SingleNameReference.java:1103)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.MessageSend.resolveType(MessageSend.java:855)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.Expression.resolveTypeWithBindings(Expression.java:1129)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.BinaryExpression.resolveType(BinaryExpression.java:1840)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.MessageSend.resolveType(MessageSend.java:906)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.Expression.resolve(Expression.java:1118)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.Statement.resolveWithBindings(Statement.java:498)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.ASTNode.resolveStatements(ASTNode.java:726)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatements(AbstractMethodDeclaration.java:720)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatements(MethodDeclaration.java:410)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:618)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1541)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1670)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:666)
        at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:919)
        at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.processCompiledUnits(Compiler.java:575)
        at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:475)
        at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:426)
        at org.aspectj.ajdt.internal.core.builder.AjBuildManager.performCompilation(AjBuildManager.java:1101)
        at org.aspectj.ajdt.internal.core.builder.AjBuildManager.performBuild(AjBuildManager.java:275)
        at org.aspectj.ajdt.internal.core.builder.AjBuildManager.batchBuild(AjBuildManager.java:188)
        at org.aspectj.ajdt.ajc.AjdtCommand.doCommand(AjdtCommand.java:103)
        at org.aspectj.ajdt.ajc.AjdtCommand.runCommand(AjdtCommand.java:47)
        at org.aspectj.tools.ajc.Main.run(Main.java:385)
        at org.aspectj.tools.ajc.Main.runMain(Main.java:274)
        at de.tobiasroeser.mill.aspectj.worker.impl.AspectjInJvmWorker.internalCompile(AspectjInJvmWorker.scala:79)
        at de.tobiasroeser.mill.aspectj.worker.impl.AspectjInJvmWorker.compile(AspectjInJvmWorker.scala:26)
        at de.tobiasroeser.mill.aspectj.AspectjModule.$anonfun$ajcTask$1(AspectjModule.scala:145)
        at mill.define.Task$TraverseCtx.evaluate(Task.scala:71)
        at mill.eval.GroupEvaluator.$anonfun$evaluateGroup$11(GroupEvaluator.scala:356)
        at scala.util.DynamicVariable.withValue(DynamicVariable.scala:59)
        at scala.Console$.withErr(Console.scala:193)
        at mill.api.SystemStreams$.$anonfun$withStreams$2(SystemStreams.scala:62)
        at scala.util.DynamicVariable.withValue(DynamicVariable.scala:59)
        at scala.Console$.withOut(Console.scala:164)
        at mill.api.SystemStreams$.$anonfun$withStreams$1(SystemStreams.scala:61)
        at scala.util.DynamicVariable.withValue(DynamicVariable.scala:59)
        at scala.Console$.withIn(Console.scala:227)
        at mill.api.SystemStreams$.withStreams(SystemStreams.scala:60)
        at mill.eval.GroupEvaluator.$anonfun$evaluateGroup$8(GroupEvaluator.scala:356)
        at mill.eval.GroupEvaluator.$anonfun$evaluateGroup$8$adapted(GroupEvaluator.scala:325)
        at scala.collection.immutable.Vector.foreach(Vector.scala:2124)
        at mill.eval.GroupEvaluator.computeAll$1(GroupEvaluator.scala:325)
        at mill.eval.GroupEvaluator.evaluateGroup(GroupEvaluator.scala:380)
        at mill.eval.GroupEvaluator.$anonfun$evaluateGroupCached$22(GroupEvaluator.scala:247)
        at scala.util.DynamicVariable.withValue(DynamicVariable.scala:59)
        at mill.eval.GroupEvaluator.$anonfun$evaluateGroupCached$2(GroupEvaluator.scala:238)
        at mill.eval.GroupEvaluator$synchronizedEval$.$anonfun$apply$1(GroupEvaluator.scala:65)
        at scala.util.Using$.resource(Using.scala:296)
        at mill.eval.GroupEvaluator$synchronizedEval$.apply(GroupEvaluator.scala:64)
        at mill.eval.GroupEvaluator.evaluateGroupCached(GroupEvaluator.scala:83)
        at mill.eval.GroupEvaluator.evaluateGroupCached$(GroupEvaluator.scala:71)
        at mill.eval.EvaluatorImpl.evaluateGroupCached(EvaluatorImpl.scala:15)
        at mill.eval.EvaluatorCore.$anonfun$evaluate0$2(EvaluatorCore.scala:116)
        at scala.concurrent.impl.Promise$Transformation.run(Promise.scala:467)
        at mill.eval.ExecutionContexts$RunNow$.execute(ExecutionContexts.scala:14)
        at scala.concurrent.impl.Promise$Transformation.submitWithValue(Promise.scala:429)
        at scala.concurrent.impl.Promise$DefaultPromise.submitWithValue(Promise.scala:338)
        at scala.concurrent.impl.Promise$DefaultPromise.dispatchOrAddCallbacks(Promise.scala:312)
        at scala.concurrent.impl.Promise$DefaultPromise.map(Promise.scala:182)
        at mill.eval.EvaluatorCore.$anonfun$evaluate0$1(EvaluatorCore.scala:92)
        at mill.eval.EvaluatorCore.$anonfun$evaluate0$1$adapted(EvaluatorCore.scala:90)
        at scala.collection.immutable.Vector.foreach(Vector.scala:2124)
        at mill.eval.EvaluatorCore.evaluate0(EvaluatorCore.scala:90)
        at mill.eval.EvaluatorCore.$anonfun$evaluate$1(EvaluatorCore.scala:43)
        at scala.util.DynamicVariable.withValue(DynamicVariable.scala:59)
        at mill.eval.EvaluatorCore.evaluate(EvaluatorCore.scala:34)
        at mill.eval.EvaluatorCore.evaluate$(EvaluatorCore.scala:26)
        at mill.eval.EvaluatorImpl.evaluate(EvaluatorImpl.scala:15)
        at mill.main.RunScript$.evaluateNamed(RunScript.scala:38)
        at mill.main.RunScript$.$anonfun$evaluateTasksNamed$2(RunScript.scala:26)
        at scala.util.Either.map(Either.scala:390)
        at mill.main.RunScript$.evaluateTasksNamed(RunScript.scala:26)
        at mill.runner.MillBuildBootstrap$.evaluateWithWatches(MillBuildBootstrap.scala:399)
        at mill.runner.MillBuildBootstrap.$anonfun$processFinalTargets$3(MillBuildBootstrap.scala:308)
        at scala.util.DynamicVariable.withValue(DynamicVariable.scala:59)
        at mill.runner.MillBuildBootstrap.processFinalTargets(MillBuildBootstrap.scala:308)
        at mill.runner.MillBuildBootstrap.evaluateRec(MillBuildBootstrap.scala:196)
        at mill.runner.MillBuildBootstrap.$anonfun$evaluate$1(MillBuildBootstrap.scala:49)
        at scala.util.DynamicVariable.withValue(DynamicVariable.scala:59)
        at mill.runner.MillBuildBootstrap.evaluate(MillBuildBootstrap.scala:48)
        at mill.runner.MillMain$.$anonfun$main0$6(MillMain.scala:234)
        at mill.runner.Watching$.watchLoop(Watching.scala:27)
        at mill.runner.MillMain$.$anonfun$main0$1(MillMain.scala:219)
        at scala.util.DynamicVariable.withValue(DynamicVariable.scala:59)
        at scala.Console$.withErr(Console.scala:193)
        at mill.api.SystemStreams$.$anonfun$withStreams$2(SystemStreams.scala:62)
        at scala.util.DynamicVariable.withValue(DynamicVariable.scala:59)
        at scala.Console$.withOut(Console.scala:164)
        at mill.api.SystemStreams$.$anonfun$withStreams$1(SystemStreams.scala:61)
        at scala.util.DynamicVariable.withValue(DynamicVariable.scala:59)
        at scala.Console$.withIn(Console.scala:227)
        at mill.api.SystemStreams$.withStreams(SystemStreams.scala:60)
        at mill.runner.MillMain$.main0(MillMain.scala:101)

Juli 26, 2024 6:21:09 PM org.aspectj.weaver.tools.Jdk14Trace info
INFORMATION: Dumping to /home/lefou/work/tototec/iba/2017-Comfis/comfis/repro-ajc-deprecated/./ajcore.20240726.182109.814.txt

1 fail|abort, 1 error, 1 warning
1 targets failed
module.kernel.compile AspectJ compiler failed with 2 errors
Watching for changes to 41 paths and 19 other values... (Enter to re-run, Ctrl-C to exit)

[357/357] module.kernel.compile 
Compiling 2 Java sources and 2 AspectJ sources to /home/lefou/work/tototec/iba/2017-Comfis/comfis/repro-ajc-deprecated/out/module/kernel/compile.dest ...
<Unknown> [warning] Found @DeclareAnnotation while current release does not support it (see 'org.aspectj.weaver.bcel.AtAjAttributes')

/home/lefou/work/tototec/iba/2017-Comfis/comfis/repro-ajc-deprecated/module/kernel/src/example/AccessRightsHelper.java [error] Internal compiler error: java.lang.NullPointerException: Cannot invoke "org.aspectj.org.eclipse.jdt.internal.compiler.lookup.AnnotationBinding.getAnnotationType()" because "annotationBinding" is null at org.aspectj.org.eclipse.jdt.internal.compiler.problem.ProblemReporter.deprecatedSinceValue(ProblemReporter.java:2033)
(no source information available)
ABORT

Exception thrown from AspectJ 1.9.22.1

This might be logged as a bug already -- find current bugs at
  https://bugs.eclipse.org/bugs/buglist.cgi?product=AspectJ&component=Compiler

Bugs for exceptions thrown have titles File:line from the top stack, 
e.g., "SomeFile.java:243"

If you don't find the exception below in a bug, please add a new bug
at https://bugs.eclipse.org/bugs/enter_bug.cgi?product=AspectJ
To make the bug a priority, please include a test program
that can reproduce this exception.
Cannot invoke "org.aspectj.org.eclipse.jdt.internal.compiler.lookup.AnnotationBinding.getAnnotationType()" because "annotationBinding" is null

when batch building BuildConfig[null] #Files=4 AopXmls=#0
Cannot invoke "org.aspectj.org.eclipse.jdt.internal.compiler.lookup.AnnotationBinding.getAnnotationType()" because "annotationBinding" is null
java.lang.NullPointerException: Cannot invoke "org.aspectj.org.eclipse.jdt.internal.compiler.lookup.AnnotationBinding.getAnnotationType()" because "annotationBinding" is null
        at org.aspectj.org.eclipse.jdt.internal.compiler.problem.ProblemReporter.deprecatedSinceValue(ProblemReporter.java:2033)
        at org.aspectj.org.eclipse.jdt.internal.compiler.problem.ProblemReporter.deprecatedType(ProblemReporter.java:1992)
        at org.aspectj.org.eclipse.jdt.internal.compiler.problem.ProblemReporter.deprecatedType(ProblemReporter.java:1976)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.SingleNameReference.resolveType(SingleNameReference.java:1103)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.MessageSend.resolveType(MessageSend.java:855)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.Expression.resolveTypeWithBindings(Expression.java:1129)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.BinaryExpression.resolveType(BinaryExpression.java:1840)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.MessageSend.resolveType(MessageSend.java:906)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.Expression.resolve(Expression.java:1118)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.Statement.resolveWithBindings(Statement.java:498)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.ASTNode.resolveStatements(ASTNode.java:726)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatements(AbstractMethodDeclaration.java:720)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatements(MethodDeclaration.java:410)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:618)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1541)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1670)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:666)
        at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:919)
        at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.processCompiledUnits(Compiler.java:575)
        at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:475)
        at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:426)
        at org.aspectj.ajdt.internal.core.builder.AjBuildManager.performCompilation(AjBuildManager.java:1101)
        at org.aspectj.ajdt.internal.core.builder.AjBuildManager.performBuild(AjBuildManager.java:275)
        at org.aspectj.ajdt.internal.core.builder.AjBuildManager.batchBuild(AjBuildManager.java:188)
        at org.aspectj.ajdt.ajc.AjdtCommand.doCommand(AjdtCommand.java:103)
        at org.aspectj.ajdt.ajc.AjdtCommand.runCommand(AjdtCommand.java:47)
        at org.aspectj.tools.ajc.Main.run(Main.java:385)
        at org.aspectj.tools.ajc.Main.runMain(Main.java:274)

It compiles fine, if I either:

lefou commented 4 months ago

Here is the build.sc to compile it:

import mill._
import mill.scalalib._
import mill.define._

import $ivy.`de.tototec::de.tobiasroeser.mill.aspectj::0.5.0`
import de.tobiasroeser.mill.aspectj._

object main extends RootModule with AspectjModule {
  def aspectjVersion = "1.9.22.1"
  def ajcOptions = Seq("-17", "-proc:none")
}
> tree src
src/
└── example
    ├── AbstractAccessRightsAspect.aj
    ├── AccessRightsAspect.aj
    └── AccessRightsHelper.java

@kriegaex Do you have some minimal Maven pom.xml for a AspectJ module?

kriegaex commented 4 months ago

The problem is not the @Deprecated annotation but the Javadoc with the @deprecated tag. If you remove it, it works. I tried from scratch from the command line:

$ java -version
java version "22" 2024-03-19
Java(TM) SE Runtime Environment (build 22+36-2370)
Java HotSpot(TM) 64-Bit Server VM (build 22+36-2370, mixed mode, sharing)

$ ajc -v
AspectJ Compiler 1.9.22.1 - Built: Friday May 10, 2024 at 23:23:16 PDT - Eclipse Compiler b2705b00e91be7 (20Mar2024) - Java22 

$ rm -r target/classes/*

$ find src/main/java/example
src/main/java/example
src/main/java/example/AbstractAccessRightsAspect.aj
src/main/java/example/AccessRightsAspect.aj
src/main/java/example/AccessRightsHelper.java

$ ajc -17 -proc:none -d target/classes -cp "c:/Program Files/Java/AspectJ/lib/aspectjrt.jar" src/main/java/example/AbstractAccessRightsAspect.aj src/main/java/example/AccessRightsAspect.aj src/main/java/example/AccessRightsHelper.java 

$ java -cp "c:/Program Files/Java/AspectJ/lib/aspectjrt.jar;target/classes" example.AccessRightsHelper
Replacing Aspect: example.AccessRightsAspect@30f39991

But as soon as I change

/**
 * Use {@link AccessRightsHelper} instead.
 */

to

/**
 * @deprecated Use {@link AccessRightsHelper} instead.
 */

I can reproduce the problem:

$ ajc -17 -proc:none -d target/classes -cp "c:/Program Files/Java/AspectJ/lib/aspectjrt.jar" src/main/java/example/AbstractAccessRightsAspect.aj src/main/java/example/AccessRightsAspect.aj src/main/java/example/AccessRightsHelper.java 
C:\Users\alexa\Documents\java-src\AspectJ\_maven-test-it\src\main\java\example\AccessRightsHelper.java [error] Internal compiler error: java.lang.NullPointerException: Cannot invoke "org.aspectj.org.eclipse.jdt.internal.compiler.lookup.AnnotationBinding.getAnnotationType()" because "annotationBinding" is null at org.aspectj.org.eclipse.jdt.internal.compiler.problem.ProblemReporter.deprecatedSinceValue(ProblemReporter.java:2033)
(no source information available)
ABORT

Exception thrown from AspectJ 1.9.22.1

This might be logged as a bug already -- find current bugs at
  https://bugs.eclipse.org/bugs/buglist.cgi?product=AspectJ&component=Compiler

Bugs for exceptions thrown have titles File:line from the top stack, 
e.g., "SomeFile.java:243"

If you don't find the exception below in a bug, please add a new bug
at https://bugs.eclipse.org/bugs/enter_bug.cgi?product=AspectJ
To make the bug a priority, please include a test program
that can reproduce this exception.
Cannot invoke "org.aspectj.org.eclipse.jdt.internal.compiler.lookup.AnnotationBinding.getAnnotationType()" because "annotationBinding" is null

when batch building BuildConfig[null] #Files=3 AopXmls=#0
Cannot invoke "org.aspectj.org.eclipse.jdt.internal.compiler.lookup.AnnotationBinding.getAnnotationType()" because "annotationBinding" is null
java.lang.NullPointerException: Cannot invoke "org.aspectj.org.eclipse.jdt.internal.compiler.lookup.AnnotationBinding.getAnnotationType()" because "annotationBinding" is null
        at org.aspectj.org.eclipse.jdt.internal.compiler.problem.ProblemReporter.deprecatedSinceValue(ProblemReporter.java:2033)
        at org.aspectj.org.eclipse.jdt.internal.compiler.problem.ProblemReporter.deprecatedType(ProblemReporter.java:1992)
        at org.aspectj.org.eclipse.jdt.internal.compiler.problem.ProblemReporter.deprecatedType(ProblemReporter.java:1976)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.SingleNameReference.resolveType(SingleNameReference.java:1103)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.MessageSend.resolveType(MessageSend.java:855)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.Expression.resolveTypeWithBindings(Expression.java:1129)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.BinaryExpression.resolveType(BinaryExpression.java:1840)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.MessageSend.resolveType(MessageSend.java:906)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.Expression.resolve(Expression.java:1118)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.Statement.resolveWithBindings(Statement.java:498)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.ASTNode.resolveStatements(ASTNode.java:726)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatements(AbstractMethodDeclaration.java:720)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatements(MethodDeclaration.java:410)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:618)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1541)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1670)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:666)
        at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:919)
        at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.processCompiledUnits(Compiler.java:575)
        at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:475)
        at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:426)
        at org.aspectj.ajdt.internal.core.builder.AjBuildManager.performCompilation(AjBuildManager.java:1101)
        at org.aspectj.ajdt.internal.core.builder.AjBuildManager.performBuild(AjBuildManager.java:275)
        at org.aspectj.ajdt.internal.core.builder.AjBuildManager.batchBuild(AjBuildManager.java:188)
        at org.aspectj.ajdt.ajc.AjdtCommand.doCommand(AjdtCommand.java:103)
        at org.aspectj.ajdt.ajc.AjdtCommand.runCommand(AjdtCommand.java:47)
        at org.aspectj.tools.ajc.Main.run(Main.java:385)
        at org.aspectj.tools.ajc.Main.runMain(Main.java:274)
        at org.aspectj.tools.ajc.Main.main(Main.java:92)

Juli 27, 2024 12:01:57 PM org.aspectj.weaver.tools.Jdk14Trace info
INFORMATION: Dumping to C:\Users\alexa\Documents\java-src\AspectJ\_maven-test-it\.\ajcore.20240727.120157.978.txt

1 fail|abort, 1 error

One more thing I found out is that the problem only occurs in native syntax aspects, not in @AspectJ-style ones.

lefou commented 4 months ago

Still, the JavaDoc @deprecated seems to be no problem, if there is no @Deprecated in the other file.

kriegaex commented 4 months ago

I.e., it must be the interplay of both. Honestly, I never used the @deprecated tag before, and it yet needs to be verified if similar problems can occur in ECJ or if this issue is specific to AJC.

kriegaex commented 4 months ago

Please note my recent message to the aspectj-users and aspectj-announce mailing lists regarding my situation as an AspectJ maintainer.

lefou commented 4 months ago

Honestly, I never used the @deprecated tag before

Since the Java @Deprecated annotation does not support any description and version parameter (compareted to Scala or Kotlin), I use the older JavaDoc @deprecated to add these info. Otherwise, deprecation messages would be non-actionable and frustrating for the user.

Please note my recent message to the aspectj-users and aspectj-announce mailing lists regarding my situation as an AspectJ maintainer.

I'm in quite a same situation honestly. Maintaining a portion of tools and libraries and often at the price of not getting things done for my main freelance jobs. So, I totally understand your position. To be clear, I don't expect any commitment on your side to any bug I report, but reporting these bugs and investigating in reproducers, even if I already found workarounds in the originating projects, is just another way of contributing. I wish you the best and really hope that some of the well-paid commercial beneficiaries of the AspectJ ecosystem step up financially and recognize the value, you provide with your contributions and community work.