Skip to content

Commit

Permalink
Fix or suppress warnings in pde.build, api.tools and pde.bnd.ui
Browse files Browse the repository at this point in the history
  • Loading branch information
HannesWell authored and fedejeanne committed Jul 31, 2024
1 parent 722679a commit a042add
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ public class ApiAnalysisBuilder extends IncrementalProjectBuilder {
*
* @since 1.0.3
*/
@SuppressWarnings("deprecation")
public static final Set<String> IMPORTANT_HEADERS = Set.of(Constants.SYSTEM_BUNDLE_SYMBOLICNAME,
Constants.BUNDLE_VERSION, Constants.REQUIRE_BUNDLE, Constants.BUNDLE_REQUIREDEXECUTIONENVIRONMENT,
Constants.EXPORT_PACKAGE, Constants.IMPORT_PACKAGE, Constants.BUNDLE_CLASSPATH);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,6 @@ public void openScript(String scriptLocation, String scriptName) throws CoreExce

protected static AntScript newAntScript(String scriptLocation, String scriptName) throws CoreException {
try {
@SuppressWarnings("resource") // intentional return AntScript without closed stream
OutputStream scriptStream = new BufferedOutputStream(new FileOutputStream(scriptLocation + '/' + scriptName));
return new AntScript(scriptStream);
} catch (FileNotFoundException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -385,17 +385,18 @@ public void addBundles(Collection<File> bundles) {
}
}

@SuppressWarnings("deprecation")
private static final String FRAMEWORK_EXECUTIONENVIRONMENT = Constants.FRAMEWORK_EXECUTIONENVIRONMENT;

public void resolveState() {
List<Config> configs = AbstractScriptGenerator.getConfigInfos();
ArrayList<Dictionary<String, Object>> properties = new ArrayList<>(); //Collection of dictionaries
Dictionary<String, Object> prop;
List<Dictionary<String, Object>> properties = new ArrayList<>(); //Collection of dictionaries

// initialize profileManager and get the JRE profiles
String[] javaProfiles = getJavaProfiles();
String ee = null;

for (Config aConfig : configs) {
prop = new Hashtable<>();
Dictionary<String, Object> prop = new Hashtable<>();
if (AbstractScriptGenerator.getPropertyAsBoolean(RESOLVER_DEV_MODE))
prop.put(PROPERTY_RESOLVER_MODE, VALUE_DEVELOPMENT);
String os = aConfig.getOs();
Expand Down Expand Up @@ -427,38 +428,37 @@ public void resolveState() {
properties.add(prop);
}

Properties profileProps = null;
boolean added = false;
String eeJava9 = null;
//javaProfiles are sorted, go in reverse order, and if when we hit 0 we haven't added any yet,
//then add that last profile so we have something.
for (int j = javaProfiles.length - 1; j >= 0; j--) {
// add a property set for each EE that is defined in the build.
profileProps = profileManager.getProfileProperties(javaProfiles[j]);
Properties profileProps = profileManager.getProfileProperties(javaProfiles[j]);
if (profileProps != null) {
String profileName = profileProps.getProperty(ProfileManager.PROFILE_NAME);
if (AbstractScriptGenerator.getImmutableAntProperty(profileName) != null || (j == 0 && !added)) {
IExecutionEnvironment env = JavaRuntime.getExecutionEnvironmentsManager().getEnvironment(javaProfiles[j]);
String systemPackages = getSystemPackages(env, profileProps);
ee = profileProps.getProperty(Constants.FRAMEWORK_EXECUTIONENVIRONMENT);
String ee = profileProps.getProperty(FRAMEWORK_EXECUTIONENVIRONMENT);

prop = new Hashtable<>();
Dictionary<String, Object> prop = new Hashtable<>();
prop.put(ProfileManager.SYSTEM_PACKAGES, systemPackages);
if (profileName.equals("JavaSE-9")) { //$NON-NLS-1$
eeJava9 = ee;
}
prop.put(Constants.FRAMEWORK_EXECUTIONENVIRONMENT, ee);
prop.put(FRAMEWORK_EXECUTIONENVIRONMENT, ee);
properties.add(prop);
added = true;
}
}
}
// from java 10 and beyond
ArrayList<String> eeJava10AndBeyond = new ArrayList<>();
List<String> eeJava10AndBeyond = new ArrayList<>();
for (int i = 10; i <= LAST_SUPPORTED_JDK; i++) {
eeJava10AndBeyond.add("JavaSE-" + i);//$NON-NLS-1$
}
prop = new Hashtable<>();
Dictionary<String, Object> prop = new Hashtable<>();
String previousEE = eeJava9;
for (String execEnvID : eeJava10AndBeyond) {
prop = new Hashtable<>();
Expand All @@ -470,7 +470,7 @@ public void resolveState() {
continue;
}
prop.put(ProfileManager.SYSTEM_PACKAGES, systemPackages);
prop.put(Constants.FRAMEWORK_EXECUTIONENVIRONMENT, currentEE);
prop.put(FRAMEWORK_EXECUTIONENVIRONMENT, currentEE);
previousEE = currentEE;
properties.add(prop);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ void addTemplateEngine(TemplateEngine engine, Map<String, Object> svcProps) {
engines.put(name, engine);
}

void removeTemplateEngine(@SuppressWarnings("unused") TemplateEngine engine, Map<String, Object> svcProps) {
void removeTemplateEngine(TemplateEngine engine, Map<String, Object> svcProps) {
String name = (String) svcProps.get("name");
engines.remove(name);
}
Expand Down

0 comments on commit a042add

Please sign in to comment.