-
Notifications
You must be signed in to change notification settings - Fork 583
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoid using Constants interface deprecated in BCEL 6.x #262
Comments
Without looking into the code: 3.1.0 release should be compatible as much as we can (to simplify transition from FB to SB), 4.0.0 is by definition "open" for new features and API can be broken (not that this is nice, but where we can't avoid this, we can't keep compatibility). |
@iloveeclipse I take “compatible as much as we can” to mean source compatible, so plug-ins that compiled against FindBugs 3.0.x should compile against SpotBugs 3.1.0. If that’s the case, I’ll prepare a change for part 1 only. This would get rid of most of the warnings already, without affecting compatibility in any way. I would also add a deprecation note to our change log, so that detector writers will know that they can’t rely on |
OK, Since part 1 is merged, I've changed the target to 4.0. |
Makes sense. |
There are still usages of the Constants interface:
|
I got different result on
Recently @wreulicke removed some usage, so I think we're really close to finish this issue. |
I confirmed that we have no implementation depends on this Const class. |
At the moment, the
spotbugs
project shows more than 1,800 warnings, 1,506 of which are caused by our use of theorg.apache.bcel.Constants
interface that has been deprecated with BCEL 6.0.IMHO, we should switch to the BCEL 6.0 replacement,
org.apache.bcel.Const
, to get our list of warnings down to a manageable level.This change would then come in two parts:
Const
rather thanConstants
ourselves.Constants
in our classes.The first part is a purely internal change, which doesn’t affect our clients. But no longer implementing the
Constants
interface may affect them.Now, the question is whether we strive to be binary compatible (old plugins should run on the new SpotBugs version) or also source compatible (old plug-ins should still compile against the new SpotBugs version) for SpotBugs 3.1.0.
Binary compatibility is easy: Most constants are primitive and inlined during compilation and the few constants which are not (
OPCODE_NAMES
,NO_OF_OPERANDS
, …) are accessed usinginvokestatic
. Hence, existing clients which extend a SpotBugs class that previously implementedConstants
would just continue to useinvokestatic
to accessConstants.*
; they wouldn’t notice that they no longer (transitively) implement the interface. This leaves only the oddball case of someone doing aninstanceof Constants
, which I am confident nobody did (because: why?).Source compatibility is probably broken, as I suspect not everyone who extends, e.g.,
BytecodeScanningDetector
adds animplements Constants
clause to their detector when accessing one of the constants themselves.Now the question: Should we do both parts of this change for SpotBugs 3.1.0, even though part 2 breaks source compatibility, or should we leave part 2 to SpotBugs 4.0.0 and only do part 1 for 3.1.0? (FYI, part 1 would already get rid of most of the deprecation warnings.)
Thoughts?
The text was updated successfully, but these errors were encountered: