GithubHelp home page GithubHelp logo

Comments (8)

KengoTODA avatar KengoTODA commented on May 28, 2024

Could you tell us which kind of failure it has? Is it not reasonable (e.g. generated code by JavaCC really has problem)?

from spotbugs-gradle-plugin.

thpr avatar thpr commented on May 28, 2024

It fails after hundreds of errors. Things like: "error: package pcgen.base.util does not exist"
...which is complaining about "import pcgen.base.util.TypedKey;"

The thing is, these are very real packages, and as I stated above, this all compiles without SpotBugs enabled.

This code has run well for a long time... over 100 versions over years. Those packages and classes the compileJavaccJava task are complaining about are very real in a JAR library. So these are configuration issues, not real code issues.

What is so baffling to me is that solely adding the spotbugs id line to build.gradle triggers this new task (and I can't find any documentation of what that task is or does) and thus leads to this set of failures.

So:

  • Is the compileJavaccJava task actually added by SpotBugs or is there some other side effect of adding SpotBugs that is unclear?
  • What is compileJavaccJava doing that is needed?
  • Does this new task try to compile code assuming it has no dependencies? If so, that is a problem...
  • Why is compileJavaccJava not drawing on known information, such as the "compile group" dependencies?

from spotbugs-gradle-plugin.

KengoTODA avatar KengoTODA commented on May 28, 2024

If you think generated code is working well, you don't care this problem so heavily. I recommend you to simply exclude generated classes from the target for SpotBugs.

I feel it's one of common patterns that generated code has problem (e.g. Lombok generates logger variable w/ bad naming) and static analysis needs to ignore them.

from spotbugs-gradle-plugin.

KengoTODA avatar KengoTODA commented on May 28, 2024

Is the compileJavaccJava task actually added by SpotBugs or is there some other side effect of adding SpotBugs that is unclear?
What is compileJavaccJava doing that is needed?

compileJavaccJava is not added by SpotBugs, but added by gradle java plugin.

Does this new task try to compile code assuming it has no dependencies? If so, that is a problem...

It depends on your config. Use auxClasspath to provide path of dependencies.

from spotbugs-gradle-plugin.

thpr avatar thpr commented on May 28, 2024

If you think generated code is working well, you don't care this problem so heavily. I recommend you to simply exclude generated classes from the target for SpotBugs.

I'm still not sure we are discussing the same problem.

I am ignoring the generated code. The code which is triggering the error isn't generated code. I already have a suppressions.xml that ignores the generated code:

compileJavaccJava is not added by SpotBugs, but added by gradle java plugin.

...but where I'm confused is that Spotbugs is causing it to run. When I do a dry run without the id line for spotbugs, I get this:
:compileJjtree SKIPPED
:compileJavacc SKIPPED
:compileJava SKIPPED
:processResources SKIPPED
:classes SKIPPED
:jar SKIPPED
:assemble SKIPPED
:compileTestJava SKIPPED
:processTestResources SKIPPED
:testClasses SKIPPED
:test SKIPPED
:check SKIPPED
:build SKIPPED

When I do it with the id line for spotbugs added, I get this:
:compileJjtree SKIPPED
:compileJavacc SKIPPED
:compileJava SKIPPED
:processResources SKIPPED
:classes SKIPPED
:jar SKIPPED
:assemble SKIPPED
:compileJavaccJava SKIPPED
:processJavaccResources SKIPPED
:javaccClasses SKIPPED
:spotbugsJavacc SKIPPED
:spotbugsMain SKIPPED

:compileTestJava SKIPPED
:processTestResources SKIPPED
:testClasses SKIPPED
:spotbugsTest SKIPPED
:test SKIPPED
:check SKIPPED
:build SKIPPED

... so SpotBugs has added a number of steps (bolded), some of which are related to Javacc that are not necessary to the original build. I'm at a loss for why these were added?

from spotbugs-gradle-plugin.

thpr avatar thpr commented on May 28, 2024

adding "-x spotbugsJavacc" to my gradle command line at least gets me a workaround.

I'm still interested to know if there is a behavior/structure related to how Javacc and gradle are used that SpotBugs is expecting and not seeing in our setup.

from spotbugs-gradle-plugin.

KengoTODA avatar KengoTODA commented on May 28, 2024

wmm, strange... I'm sure that the tasks with spotbugs prefix are generated by spotbugs-gradle-plugin,
But following three tasks should come from other place.

:compileJavaccJava SKIPPED
:processJavaccResources SKIPPED
:javaccClasses SKIPPED

I guess they are java plugin's sourceSet tasks.

from spotbugs-gradle-plugin.

KengoTODA avatar KengoTODA commented on May 28, 2024

I'll close this inactive issue. If you could reproduce this with the latest release, please feel free to reopen.

from spotbugs-gradle-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.