Skip to content

Commit

Permalink
Merge pull request #5913 from pkriens/build/warning-fixes
Browse files Browse the repository at this point in the history
#5904 introduced a lot of warnings.
  • Loading branch information
pkriens authored Dec 1, 2023
2 parents 253ae2b + efbbc04 commit fa734ef
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 22 deletions.
2 changes: 1 addition & 1 deletion biz.aQute.bndlib.tests/test/test/AnalyzerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ public void testBundleClasspath() throws Exception {
Builder b = new Builder();
try {
b.setProperty(Constants.BUNDLE_CLASSPATH, "foo");
b.setProperty(Constants.INCLUDE_RESOURCE, "foo/test/refer=bin_test/test/refer");
b.setProperty(Constants.INCLUDERESOURCE, "foo/test/refer=bin_test/test/refer");
b.setProperty(Constants.EXPORT_CONTENTS, "test.refer");
Jar jar = b.build();
Manifest m = jar.getManifest();
Expand Down
6 changes: 3 additions & 3 deletions biz.aQute.bndlib.tests/test/test/BuilderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2533,7 +2533,7 @@ static void assertVersion(String input, String expected) {
public void testExportContents() throws Exception {
Builder builder = new Builder();
try {
builder.setProperty(Constants.INCLUDE_RESOURCE, "test/activator/inherits=test/test/activator/inherits");
builder.setProperty(Constants.INCLUDERESOURCE, "test/activator/inherits=test/test/activator/inherits");
builder.setProperty("-exportcontents", "*;x=true;version=1");
builder.build();
assertTrue(builder.check());
Expand Down Expand Up @@ -2700,7 +2700,7 @@ public void testStrategyMergeLast() throws Exception {
public void testResourceNotFound() throws Exception {
Properties base = new Properties();
base.put(Constants.EXPORT_PACKAGE, "*;x-test:=true");
base.put(Constants.INCLUDE_RESOURCE, "does_not_exist");
base.put(Constants.INCLUDERESOURCE, "does_not_exist");
Builder analyzer = new Builder();
try {
analyzer.setClasspath(new File[] {
Expand All @@ -2721,7 +2721,7 @@ public void testResourceNotFound() throws Exception {
@Test
public void testFindPathInBundleClasspath() throws Exception {
Properties base = new Properties();
base.put(Constants.INCLUDE_RESOURCE, "jar=jar");
base.put(Constants.INCLUDERESOURCE, "jar=jar");
base.put(Constants.BUNDLE_CLASSPATH, "${findpath;jar/.{1,4}\\.jar}");
Builder analyzer = new Builder();
try {
Expand Down
8 changes: 4 additions & 4 deletions biz.aQute.bndlib.tests/test/test/PreprocessTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class PreprocessTest {
@Test
public void testPreProcessDefaultExclusion() throws Exception {
Builder b = new Builder();
b.setProperty(Constants.INCLUDE_RESOURCE, "{test/test/tb1.jar} ");
b.setProperty(Constants.INCLUDERESOURCE, "{test/test/tb1.jar} ");
b.build();
assertTrue(b.check());

Expand All @@ -51,7 +51,7 @@ public void testPreProcessDefaultExclusion() throws Exception {
public void testPreProcessExcludeExtensionGlobal() throws Exception {
Builder b = new Builder();
b.setProperty(Constants.PREPROCESSMATCHERS, "!*.TXT:i,*");
b.setProperty(Constants.INCLUDE_RESOURCE,
b.setProperty(Constants.INCLUDERESOURCE,
"{test/test/builder-preprocess.txt},{test/test/builder-preprocess.txt2}");
b.setProperty("var", "Yes!");

Expand Down Expand Up @@ -80,7 +80,7 @@ public void testPreProcessExcludeExtensionGlobal() throws Exception {
@Test
public void testPreProcessExcludeExtensionLocal() throws Exception {
Builder b = new Builder();
b.setProperty(Constants.INCLUDE_RESOURCE,
b.setProperty(Constants.INCLUDERESOURCE,
"{test/test/builder-preprocess.txt};-preprocessmatchers='!*.TXT:i,*'");
b.setProperty("var", "Yes!");

Expand All @@ -105,7 +105,7 @@ public void testPreProcessExcludeExtensionLocal() throws Exception {
@Test
public void testPreProcess() throws Exception {
Properties base = new Properties();
base.put(Constants.INCLUDE_RESOURCE, "{test/test/top.mf} ");
base.put(Constants.INCLUDERESOURCE, "{test/test/top.mf} ");
Builder analyzer = new Builder();
analyzer.setProperties(base);
analyzer.build();
Expand Down
4 changes: 2 additions & 2 deletions biz.aQute.bndlib/src/aQute/bnd/help/Syntax.java
Original file line number Diff line number Diff line change
Expand Up @@ -506,9 +506,9 @@ null, null, new Syntax("name", "The display name of the developer", "name='Peter
"Include resources from the file system. You can specify a directory, or file. All files are copied to the root, unless a destination directory is indicated.",
INCLUDERESOURCE + ": lib/=jar/, {preprocess.txt}, license.txt;literal:='ASL 2.0, -doesnotexit.txt'", null,
null),
new Syntax(INCLUDE_RESOURCE,
new Syntax(INCLUDERESOURCE,
"Include resources from the file system. You can specify a directory, or file. All files are copied to the root, unless a destination directory is indicated.",
INCLUDE_RESOURCE + ": lib/=jar/, {preprocess.txt}, 'literal';literal;=true,", null, null),
INCLUDERESOURCE + ": lib/=jar/, {preprocess.txt}, 'literal';literal;=true,", null, null),
new Syntax(INIT, "Executes macros while initializing the project for building", INIT + ": ${my_macro} ", null,
null),
new Syntax(JAVAAGENT, "Specify if classpath jars with Premain-Class headers are to be used as java agents.",
Expand Down
1 change: 1 addition & 0 deletions biz.aQute.bndlib/src/aQute/bnd/make/MakeBnd.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

public class MakeBnd implements MakePlugin, Constants {

@SuppressWarnings("deprecation")
@Override
public Resource make(Builder builder, String destination, Map<String, String> argumentsOnMake) throws Exception {
String type = argumentsOnMake.get("type");
Expand Down
20 changes: 13 additions & 7 deletions biz.aQute.bndlib/src/aQute/bnd/osgi/Builder.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@
*/
public class Builder extends Analyzer {

@SuppressWarnings("deprecation")
private static final String INCLUDERESOURCE_HEADERS = Constants.INCLUDERESOURCE + "|" + Constants.INCLUDE_RESOURCE;

private final static Logger logger = LoggerFactory.getLogger(Builder.class);
private final static Pattern IR_PATTERN = Pattern
.compile("[{]?-?@?(?:[^=]+=)?\\s*([^}!]+).*");
Expand Down Expand Up @@ -907,6 +910,7 @@ private Instruction matches(Instructions instructions, String pack, Set<Instruct
* @throws IOException
* @throws FileNotFoundException
*/
@SuppressWarnings("deprecation")
private void doIncludeResources(Jar jar) throws Exception {
Parameters includes = parseHeader(getProperty("Bundle-Includes"));
if (includes.isEmpty()) {
Expand Down Expand Up @@ -1004,7 +1008,8 @@ private void doIncludeResource(Jar jar, String name, Map<String, String> extra)

private void doClassAttribute(Jar jar, String name, Map<String, String> extra, Instructions preprocess,
boolean absentIsOk) throws Exception {
FileLine header = getHeader(Constants.INCLUDE_RESOURCE, Constants.CLASS_ATTRIBUTE);
FileLine header = getHeader(INCLUDERESOURCE_HEADERS,
Constants.CLASS_ATTRIBUTE);
String fqn = extra.get(Constants.CLASS_ATTRIBUTE);
TypeRef typeRef = getTypeRefFromFQN(fqn);
if (typeRef == null) {
Expand Down Expand Up @@ -1091,8 +1096,8 @@ private void doCommand(Jar jar, String source, String destination, Map<String, S
for (String required : requires) {
File file = getFile(required);
if (!file.exists()) {
error(Constants.INCLUDE_RESOURCE + ".cmd for %s, requires %s, but no such file %s", source, required,
file.getAbsoluteFile()).header(INCLUDERESOURCE + "|" + INCLUDE_RESOURCE);
error(Constants.INCLUDERESOURCE + ".cmd for %s, requires %s, but no such file %s", source, required,
file.getAbsoluteFile()).header(INCLUDERESOURCE_HEADERS);
} else
lastModified = findLastModifiedWhileOlder(file, lastModified());
}
Expand Down Expand Up @@ -1156,7 +1161,7 @@ private void doCommand(Jar jar, String source, String destination, Map<String, S
if (cr != null)
jar.putResource(destination, cr);

updateModified(lastModified, Constants.INCLUDE_RESOURCE + ": cmd");
updateModified(lastModified, Constants.INCLUDERESOURCE + ": cmd");
}

private void traverse(List<String> paths, File item) {
Expand Down Expand Up @@ -1245,7 +1250,7 @@ private void resolveFiles(File dir, FileFilter filter, boolean recursive, String
} else {
String p = appendPath(path, file.getName());
if (files.containsKey(p))
warning(Constants.INCLUDE_RESOURCE + " overwrites entry %s from file %s", p, file);
warning(Constants.INCLUDERESOURCE + " overwrites entry %s from file %s", p, file);
files.put(p, file);
}
}
Expand All @@ -1257,7 +1262,7 @@ private void resolveFiles(File dir, FileFilter filter, boolean recursive, String

private void noSuchFile(Jar jar, String clause, Map<String, String> extra, String source, String destinationPath)
throws Exception {
List<Jar> src = getJarsFromName(source, Constants.INCLUDE_RESOURCE + " " + source);
List<Jar> src = getJarsFromName(source, Constants.INCLUDERESOURCE + " " + source);
if (!src.isEmpty()) {
for (Jar j : src) {
File sourceFile = j.getSource();
Expand Down Expand Up @@ -1366,6 +1371,7 @@ private boolean addAll(Jar to, Jar sub, Instruction filter, String destination,
return dupl;
}

@SuppressWarnings("deprecation")
private void copy(Jar jar, String path, File from, Instructions preprocess, Map<String, String> extra)
throws Exception {
if (doNotCopy(from))
Expand Down Expand Up @@ -2014,7 +2020,7 @@ public Builder from(BuilderSpecification spec) throws IOException {
}

if (!spec.includeresource.isEmpty()) {
setProperty(Constants.INCLUDE_RESOURCE, new Parameters(spec.includeresource).toString());
setProperty(Constants.INCLUDERESOURCE, new Parameters(spec.includeresource).toString());
}

if (!spec.privatePackage.isEmpty()) {
Expand Down
7 changes: 4 additions & 3 deletions biz.aQute.bndlib/src/aQute/bnd/osgi/Domain.java
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,10 @@ public Parameters getPrivatePackage() {
return p;
}

@SuppressWarnings("deprecation")
public Parameters getIncludeResource() {
Parameters ic = getParameters(INCLUDE_RESOURCE);
ic.putAll(getParameters(INCLUDERESOURCE));
Parameters ic = getParameters(INCLUDERESOURCE);
ic.putAll(getParameters(INCLUDE_RESOURCE));
ic.putAll(getParameters(WAB));
return ic;
}
Expand Down Expand Up @@ -268,7 +269,7 @@ public void setPrivatePackage(String s) {

public void setIncludeResource(String s) {
if (s != null)
set(INCLUDE_RESOURCE, s);
set(INCLUDERESOURCE, s);
}

public void setBundleActivator(String s) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ private LauncherConstants getConstants(Collection<String> runbundles, boolean ex
* launcher.embedded flag.
*/

@SuppressWarnings("deprecation")
@Override
public Jar executable() throws Exception {
Executable instrs = launcherInstrs.executable();
Expand Down
2 changes: 0 additions & 2 deletions bndtools.core/src/bndtools/utils/EditorUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ public static final IFormPart findPartByClass(IManagedForm form, Class<? extends
*
* @param url
* @param tooltipText
* @return
*/
public static final Action createHelpButton(String url, String tooltipText) {
Action btn = new Action("Help", IAction.AS_PUSH_BUTTON) {
Expand All @@ -69,7 +68,6 @@ public void run() {
* @param url
* @param buttonText
* @param tooltipText
* @return
*/
public static final ActionContributionItem createHelpButtonWithText(String url, String buttonText, String tooltipText) {
Action btn = createHelpButton(url, tooltipText);
Expand Down

0 comments on commit fa734ef

Please sign in to comment.