spotbugs / discuss

SpotBugs mailing list
6 stars 1 forks source link

Is it helpful to provide smaller artifact? #96

Open KengoTODA opened 4 years ago

KengoTODA commented 4 years ago

@uhafner I found this your comment and want to ask one thing.

using the internal parser is also not very elegant since the whole SpotBugs library is required as a dependency

Is it helpful for you if spotbugs provides a thin artifact that provides:

  1. Interface and abstract classes such as BugReporter, BugInstance etc., or
  2. only core parts which does not include GUI and default detectors (https://github.com/spotbugs/spotbugs/issues/193)

I think both are possible, but not sure how it helps your development.

uhafner commented 4 years ago

Yes, that would be helpful indeed! Currently the parser is quite simple, it just calls your API and adapts it to my object model: https://github.com/jenkinsci/analysis-model/blob/master/src/main/java/edu/hm/hafner/analysis/parser/FindBugsParser.java#L128

In order to reference your parser I needed to create a patched version of your library that shades several dependencies (like ASM, which should not be required by the XML parser anyway): https://github.com/jenkinsci/findbugs-plugin/blob/master/library/pom.xml

This works for a long time now, but it causes several problems from time to time. (E.g. SAX parser using the wrong class loader, etc.).

So yes, providing 1. would be very nice. (If it also would include the parser)

KengoTODA commented 4 years ago

I've checked imported classes in your code:

import edu.umd.cs.findbugs.BugAnnotation; import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.Project; import edu.umd.cs.findbugs.SortedBugCollection; import edu.umd.cs.findbugs.SourceLineAnnotation;

They are XMLWriteable or its collection, then it's reasonable to put them into one artifact such as spotbugs-elements or spotbugs-entities.

import edu.umd.cs.findbugs.annotations.Nullable;

This is annotation and already provided as spotbugs-annotations.

import edu.umd.cs.findbugs.ba.SourceFile; import edu.umd.cs.findbugs.ba.SourceFinder;

Not sure how I should categorize them... util? Emm... When I found a good naming for it, I think we can extract them as an artifact.

KengoTODA commented 4 years ago

I found that Project depends on many classes including SourceFinder.

import edu.umd.cs.findbugs.ba.SourceFinder; import edu.umd.cs.findbugs.ba.URLClassPath; import edu.umd.cs.findbugs.charsets.UTF8; import edu.umd.cs.findbugs.config.UserPreferences; import edu.umd.cs.findbugs.filter.Filter; import edu.umd.cs.findbugs.io.IO; import edu.umd.cs.findbugs.util.Util;

KengoTODA commented 4 years ago

I found that the xml package is easy to extract. We have 10 XMLWritable implementations and two of them are easy to move (worked in https://github.com/spotbugs/spotbugs/commit/d5be74c59e59ad8ac7331f15a6f1ad75d41c6d5d):

But the other eight classes are difficult to extract, especially BugInstance which needs other packages and BCEL & ASM.

Then I'll try to find how 2 can minify the artifact.