kieker-monitoring / kieker

Kieker's main repository
Apache License 2.0
70 stars 41 forks source link

[KIEKER-1366] Extend check script to check for AspectJ compiler warnings #2478

Open rju opened 2 days ago

rju commented 2 days ago

JIRA Issue: KIEKER-1366 Extend check script to check for AspectJ compiler warnings Original Reporter: Andre van Hoorn


Example:

[ant:iajc] warning at Around("execution(public com.sun.jersey.api.client.ClientResponse com.sun.jersey.client.apache4.ApacheHttpClient4Handler.handle(com.sun.jersey.api.client.ClientRequest))")
                                                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/home/tp/Tools/kieker/kieker-nightly/kieker-monitoring/src/kieker/monitoring/probe/aspectj/jersey/OperationExecutionJerseyClientInterceptor.java:61:0::0 no match for this type name: com.sun.jersey.client.apache4.ApacheHttpClient4Handler [Xlint:invalidAbsoluteTypeName]

Currently, we wouldn't notice such problem (automatically).

rju commented 1 day ago

author André van Hoorn -- Sat, 26 Sep 2015 01:08:58 +0200

How to reproduce:

1. Adding reference to non-existing class into Aspect (in this case OperationExecutionJerseyClientInterceptor)

avhAndrè van Hoorn-ThinkPad-RSS:0:~/git_work/kieker <1.12>* $ git diff 
diff --git a/kieker-monitoring/src/kieker/monitoring/probe/aspectj/jersey/OperationExecutionJerseyClientInterceptor.java b/kieker-monitoring/src/kieker/monitoring/probe/aspectj/jersey/OperationExecutionJerseyClientInterceptor.java
index 76667df..977c420 100644
--- a/kieker-monitoring/src/kieker/monitoring/probe/aspectj/jersey/OperationExecutionJerseyClientInterceptor.java
+++ b/kieker-monitoring/src/kieker/monitoring/probe/aspectj/jersey/OperationExecutionJerseyClientInterceptor.java
 -71,7 +71,7  public class OperationExecutionJerseyClientInterceptor extends AbstractAspectJPr
         *
         * return value of the intercepted method
         */
-       Around("execution(public com.sun.jersey.api.client.ClientResponse com.sun.jersey.client.apache4.ApacheHttpClient4Handler.handle(com.sun.jersey.api.client.ClientRequest))")
+       Around("execution(public XXcom.sun.jersey.api.client.ClientResponse com.sun.jersey.client.apache4.ApacheHttpClient4Handler.handle(com.sun.jersey.api.client.ClientRequest))")
        public Object operation(final ProceedingJoinPoint thisJoinPoint) throws Throwable { // NOCS (Throwable)
                if (!CTRLINST.isMonitoringEnabled()) {
                        return thisJoinPoint.proceed();

2. The warning is displayed during the build:

avhAndrè van Hoorn-ThinkPad-RSS:0:~/git_work/kieker <1.12>* $ gradle distribute -x check -x test
JAR to delete: ArchivePublishArtifact kieker:jar:jar:
:kieker-common:replaceHardCodedVersionNames
:kieker-common:compileJava
warning: [options] bootstrap class path not set in conjunction with -source 1.6
1 warning
:kieker-common:processResources UP-TO-DATE
:kieker-common:classes
:kieker-common:jar
:kieker-analysis:compileJava
warning: [options] bootstrap class path not set in conjunction with -source 1.6
1 warning
:kieker-analysis:processResources UP-TO-DATE
:kieker-analysis:classes
:kieker-analysis:jar
:kieker-analysis:assemble
:kieker-analysis:build
:kieker-common:assemble
:kieker-common:build
:kieker-monitoring:compileJava
warning: [options] bootstrap class path not set in conjunction with -source 1.6
1 warning
[ant:iajc] warning at Around("execution(public XXcom.sun.jersey.api.client.ClientResponse com.sun.jersey.client.apache4.ApacheHttpClient4Handler.handle(com.sun.jersey.api.client.ClientRequest))")
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/mnt/sda1/avh-data/kieker/kieker-monitoring/src/kieker/monitoring/probe/aspectj/jersey/OperationExecutionJerseyClientInterceptor.java:74:0::0 no match for this type name: XXcom.sun.jersey.api.client.ClientResponse [Xlint:invalidAbsoluteTypeName]
:kieker-monitoring:processResources
:kieker-monitoring:classes
:kieker-monitoring:jar
:kieker-monitoring:assemble

3. One way to check this could be an extension of the check script. For this, we could, for instance, parse the output of the following Gradle call:

   # now build release from source (including checks and tests)
    run_gradle distribute

However, I don't have a good idea how to grep the Gradle output, because just adding "| grep ..." would hide gradle's return code and the script might not terminate on a non-zero return code of gradle.

Would be better if you could configure the compiler to abort on such a warning.

rju commented 1 day ago

author André van Hoorn -- Thu, 1 Oct 2015 10:56:03 +0200

Replying to [avh|comment:2]:
>
> [...]
>
> Would be better if you could configure the compiler to abort on such a warning.

Seems like simply the adviceDidNotMatch property in the file kieker-monitoring/aspectjXlint.properties needs to be changed. Current setting:

adviceDidNotMatch = ignore
rju commented 1 day ago

author André van Hoorn -- Tue, 26 Sep 2017 17:02:11 +0200

Looks like valid values are ignore/warning/error: https://bugs.eclipse.org/bugs/show_bug.cgi?id=419279

Will test in a branch what happens if we change to error.

rju commented 1 day ago

author André van Hoorn -- Fri, 29 Sep 2017 17:44:38 +0200

Doesn't seem to be that easy. Changing to error resulted in a compile error:

<noformat>
Note: Recompile with -Xlint:deprecation for details.
[ant:iajc] error at /opt/kieker/kieker-monitoring/src/kieker/monitoring/probe/aspectj/flow/operationCallObject/AbstractAspect.java:172::0 advice defined in kieker.monitoring.probe.aspectj.flow.operationCallObject.AbstractAspect has not been applied [Xlint:adviceDidNotMatch]
[ant:iajc] error at /opt/kieker/kieker-monitoring/src/kieker/monitoring/probe/aspectj/jersey/OperationExecutionJerseyServerInterceptor.java:182::0 advice defined in kieker.monitoring.probe.aspectj.jersey.OperationExecutionJerseyServerInterceptor has not been applied [Xlint:adviceDidNotMatch]
[ant:iajc] error at /opt/kieker/kieker-monitoring/src/kieker/monitoring/probe/aspectj/flow/operationCall/AbstractAspect.java:167::0 advice defined in kieker.monitoring.probe.aspectj.flow.operationCall.AbstractAspect has not been applied [Xlint:adviceDidNotMatch]
[ant:iajc] error at /opt/kieker/kieker-monitoring/src/kieker/monitoring/probe/aspectj/flow/operationCallObject/AbstractAspect.java:132::0 advice defined in kieker.monitoring.probe.aspectj.flow.operationCallObject.AbstractAspect has not been applied [Xlint:adviceDidNotMatch]

...

[ant:iajc] [error 29]: error at /opt/kieker/kieker-monitoring/src/kieker/monitoring/probe/aspectj/flow/concurrency/ThreadingAspect.java:56::0 advice defined in kieker.monitoring.probe.aspectj.flow.concurrency.ThreadingAspect has not been applied [Xlint:adviceDidNotMatch]
[ant:iajc] [error 30]: error at /opt/kieker/kieker-monitoring/src/kieker/monitoring/probe/aspectj/operationExecution/AbstractOperationExecutionAspectServlet.java:46::0 advice defined in kieker.monitoring.probe.aspectj.operationExecution.AbstractOperationExecutionAspectServlet has not been applied [Xlint:adviceDidNotMatch]
:kieker-monitoring:compileJava FAILED
<noformat>