Add enforceBytecodeVersion rule based on mojohaus#968
Add enforceBytecodeVersion rule based on mojohaus#968
Conversation
This rule is very often used, and does not require anything special like new dependency, hence it should be among "built in" rules. OTOH, it had issues, for example on larger multi projects did recheck same (potentinally huge) JAR over and over again. It is now altered to not repeat same check (same options against same file).
| JDK_TO_MAJOR_VERSION_NUMBER_MAPPING.put("8", 52); | ||
| JDK_TO_MAJOR_VERSION_NUMBER_MAPPING.put("1.8", 52); | ||
| // Java9 | ||
| JDK_TO_MAJOR_VERSION_NUMBER_MAPPING.put("9", 53); |
There was a problem hiding this comment.
Maps for jdk version > 52 is not requred, it will be computed
please look at methods renderVersion , decodeMajorVersion
There was a problem hiding this comment.
version > 53, even ITs use notation like "1.9".
| @@ -0,0 +1,613 @@ | |||
| /* | |||
| * Licensed to the Apache Software Foundation (ASF) under one | |||
There was a problem hiding this comment.
License header is duplicated
|
Applied PR comments and added new option |
|
We also need to add a documentation. I don't know why one test fail on Jenkins ... |
|
As it is a modified version not directly copied from mojohaus, maybe we can change tile of change to something like:
To avoid questions about IP rights 😄 |
This rule is very often used, and does not require anything special like new dependency, hence it should be among "built in" rules.
OTOH, it had issues, for example on larger multi projects did recheck same (potentially huge) JAR over and over again. It is now altered to not repeat same check (same options against same file) within same session.
This rule is 100% drop-in replacement for old uses (ITs are unmodified and just copied over), moreover rule itself has set priority that if enforce plugin gets updated with this rule, but the extra rules are present, the new rule will kick in. All the options are same as before, and rule name is unchanged as well.
Where it differs, and is reflected in ITs: is not so chatty as mojohaus one, it does not tell "skipped due scope", "skipped due regexp" etc, hence ITs are modified to simply assert for presence or absence of "[DEBUG] Analyzing GAV..." string instead.