Merge branch 'improve_updatecenter_wip'
Review on private@netbeans.apache.org - References:
https://lists.apache.org/thread.html/3313fe7ecab7d861356f2a2d218041ee97aafec588120ade4e7480d3%40%3Cprivate.netbeans.apache.org%3E
https://lists.apache.org/thread.html/3313fe7ecab7d861356f2a2d218041ee97aafec588120ade4e7480d3%40%3Cprivate.netbeans.apache.org%3E
https://lists.apache.org/thread.html/4b628153ef6ce965d757608926e2a6dae1ebee3a6ba9ee630c4d7c6d%40%3Cprivate.netbeans.apache.org%3E
diff --git a/enterprise/glassfish.common/src/org/netbeans/modules/glassfish/common/BasicTask.java b/enterprise/glassfish.common/src/org/netbeans/modules/glassfish/common/BasicTask.java
index c51874d..64c8b7f 100644
--- a/enterprise/glassfish.common/src/org/netbeans/modules/glassfish/common/BasicTask.java
+++ b/enterprise/glassfish.common/src/org/netbeans/modules/glassfish/common/BasicTask.java
@@ -188,7 +188,7 @@
////////////////////////////////////////////////////////////////////////
/** Command execution task. */
- private final BasicTask task;
+ private final BasicTask<?> task;
/** New state of current command execution. */
private final TaskState result;
@@ -214,7 +214,7 @@
* @param event Event that caused state change.
* @param msgKey Message bundle key.
*/
- protected StateChange(final BasicTask task, final TaskState result,
+ protected StateChange(final BasicTask<?> task, final TaskState result,
final TaskEvent event, final String msgKey) {
this.task = task;
this.result = result;
@@ -232,7 +232,7 @@
* @param msgKey Message bundle key.
* @param msgArgs Message arguments.
*/
- protected StateChange(final BasicTask task, final TaskState result,
+ protected StateChange(final BasicTask<?> task, final TaskState result,
final TaskEvent event, final String msgKey,
final String... msgArgs) {
this.task = task;
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/BasicTask.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/BasicTask.java
index faf92a2..c360887 100644
--- a/enterprise/payara.common/src/org/netbeans/modules/payara/common/BasicTask.java
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/BasicTask.java
@@ -188,7 +188,7 @@
////////////////////////////////////////////////////////////////////////
/** Command execution task. */
- private final BasicTask task;
+ private final BasicTask<?> task;
/** New state of current command execution. */
private final TaskState result;
@@ -214,7 +214,7 @@
* @param event Event that caused state change.
* @param msgKey Message bundle key.
*/
- protected StateChange(final BasicTask task, final TaskState result,
+ protected StateChange(final BasicTask<?> task, final TaskState result,
final TaskEvent event, final String msgKey) {
this.task = task;
this.result = result;
@@ -232,7 +232,7 @@
* @param msgKey Message bundle key.
* @param msgArgs Message arguments.
*/
- protected StateChange(final BasicTask task, final TaskState result,
+ protected StateChange(final BasicTask<?> task, final TaskState result,
final TaskEvent event, final String msgKey,
final String... msgArgs) {
this.task = task;
diff --git a/groovy/groovy.editor/nbproject/project.properties b/groovy/groovy.editor/nbproject/project.properties
index a9b3566..003191f 100644
--- a/groovy/groovy.editor/nbproject/project.properties
+++ b/groovy/groovy.editor/nbproject/project.properties
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
javac.compilerargs=-Xlint -Xlint:-serial
-javac.source=1.7
+javac.source=1.8
nbm.homepage=http://wiki.netbeans.org/groovy
nbm.module.author=Martin Adamek, Petr Hejl, Matthias Schmidt, Martin Janicek
diff --git a/groovy/groovy.editor/src/org/netbeans/modules/groovy/editor/compiler/ClassNodeCache.java b/groovy/groovy.editor/src/org/netbeans/modules/groovy/editor/compiler/ClassNodeCache.java
index c88a21d..79599a3 100644
--- a/groovy/groovy.editor/src/org/netbeans/modules/groovy/editor/compiler/ClassNodeCache.java
+++ b/groovy/groovy.editor/src/org/netbeans/modules/groovy/editor/compiler/ClassNodeCache.java
@@ -22,7 +22,6 @@
import groovy.lang.GroovyResourceLoader;
import java.lang.ref.Reference;
import java.lang.ref.SoftReference;
-import java.net.MalformedURLException;
import java.net.URL;
import java.security.AccessController;
import java.security.PrivilegedAction;
@@ -303,20 +302,9 @@
private final ClassNodeCache cache;
- private final GroovyResourceLoader resourceLoader = new GroovyResourceLoader() {
-
- @Override
- public URL loadGroovySource(final String filename) throws MalformedURLException {
- URL file = (URL) AccessController.doPrivileged(new PrivilegedAction() {
-
- @Override
- public Object run() {
- return getSourceFile(filename);
- }
- });
- return file;
- }
- };
+ private final GroovyResourceLoader resourceLoader
+ = (String filename) -> AccessController.doPrivileged(
+ (PrivilegedAction<URL>) () -> getSourceFile(filename));
public ParsingClassLoader(
@NonNull ClassPath path,
diff --git a/ide/api.java.classpath/src/org/netbeans/api/java/classpath/ClassLoaderSupport.java b/ide/api.java.classpath/src/org/netbeans/api/java/classpath/ClassLoaderSupport.java
index 4067d7b..725a058 100644
--- a/ide/api.java.classpath/src/org/netbeans/api/java/classpath/ClassLoaderSupport.java
+++ b/ide/api.java.classpath/src/org/netbeans/api/java/classpath/ClassLoaderSupport.java
@@ -27,6 +27,7 @@
import java.security.PermissionCollection;
import java.security.Permissions;
import java.util.ArrayDeque;
+import java.util.ArrayList;
import java.util.Deque;
import java.util.HashMap;
import java.util.List;
@@ -90,8 +91,8 @@
* @throws ClassNotFoundException
*/
@Override
- protected Class findClass (String name) throws ClassNotFoundException {
- Class c = super.findClass (name);
+ protected Class<?> findClass (String name) throws ClassNotFoundException {
+ Class<?> c = super.findClass (name);
if (c != null) {
org.openide.filesystems.FileObject fo;
String resName = name.replace('.', '/') + ".class"; // NOI18N
@@ -256,18 +257,18 @@
}
private void removeAllListeners() {
- Map.Entry[] removeListenerFrom;
+ List<Map.Entry<FileObject, Boolean>> removeListenerFrom;
synchronized(lock){
detachedFromCp = true; //No need to add more listeners
if (emittedFileObjects.isEmpty()) {
return;
}
- removeListenerFrom = emittedFileObjects.entrySet().toArray(new Map.Entry[emittedFileObjects.size()]);
+ removeListenerFrom = new ArrayList<>(emittedFileObjects.entrySet());
emittedFileObjects.clear();
}
- for (Map.Entry e : removeListenerFrom) {
+ for (Map.Entry<FileObject, Boolean> e : removeListenerFrom) {
if (e.getValue() == Boolean.TRUE) {
- ((FileObject)e.getKey()).removeFileChangeListener(listener);
+ e.getKey().removeFileChangeListener(listener);
}
}
}
diff --git a/ide/api.java.classpath/src/org/netbeans/api/java/queries/BinaryForSourceQuery.java b/ide/api.java.classpath/src/org/netbeans/api/java/queries/BinaryForSourceQuery.java
index 99a3f19..254b505 100644
--- a/ide/api.java.classpath/src/org/netbeans/api/java/queries/BinaryForSourceQuery.java
+++ b/ide/api.java.classpath/src/org/netbeans/api/java/queries/BinaryForSourceQuery.java
@@ -232,11 +232,11 @@
static final class QueriesAccessorImpl extends QueriesAccessor {
QueriesAccessorImpl() {
}
- private final Map<Object, Result2Impl> cache = new WeakHashMap<>();
+ private final Map<Object, Result2Impl<?>> cache = new WeakHashMap<>();
@Override
public synchronized <T> Result2 create(BinaryForSourceQueryImplementation2<T> impl, T value) {
- Result2Impl result = cache.get(value);
+ Result2Impl<?> result = cache.get(value);
if (result == null) {
result = new Result2Impl<>(impl, value);
cache.put(value, result);
diff --git a/ide/api.java.classpath/src/org/netbeans/modules/java/classpath/ClassPathAccessor.java b/ide/api.java.classpath/src/org/netbeans/modules/java/classpath/ClassPathAccessor.java
index 5a1d422..605818b 100644
--- a/ide/api.java.classpath/src/org/netbeans/modules/java/classpath/ClassPathAccessor.java
+++ b/ide/api.java.classpath/src/org/netbeans/modules/java/classpath/ClassPathAccessor.java
@@ -33,7 +33,7 @@
public static synchronized ClassPathAccessor getDefault() {
ClassPathAccessor instance = DEFAULT;
if (instance == null) {
- Class c = ClassPath.class;
+ Class<?> c = ClassPath.class;
try {
Class.forName(c.getName(), true, c.getClassLoader());
instance = DEFAULT;
diff --git a/ide/api.java.classpath/test/unit/src/org/netbeans/api/java/classpath/ClassPathTest.java b/ide/api.java.classpath/test/unit/src/org/netbeans/api/java/classpath/ClassPathTest.java
index 1eaf4f1..667229d 100644
--- a/ide/api.java.classpath/test/unit/src/org/netbeans/api/java/classpath/ClassPathTest.java
+++ b/ide/api.java.classpath/test/unit/src/org/netbeans/api/java/classpath/ClassPathTest.java
@@ -158,7 +158,7 @@
assertTrue (cp.findResource("org/me/None.txt")==null);
//findAllResources
- List res = cp.findAllResources ("org/me/Foo.txt");
+ List<FileObject> res = cp.findAllResources ("org/me/Foo.txt");
assertTrue (res.size() == 2);
assertTrue (res.contains(testFo_1));
assertTrue (res.contains(testFo_2));
@@ -339,8 +339,8 @@
}
public synchronized void removeResource (URL resource) {
- for (Iterator it = this.resources.iterator(); it.hasNext();) {
- PathResourceImplementation pr = (PathResourceImplementation) it.next ();
+ for (Iterator<PathResourceImplementation> it = this.resources.iterator(); it.hasNext();) {
+ PathResourceImplementation pr = it.next ();
if (Arrays.asList(pr.getRoots()).contains (resource)) {
this.resources.remove (pr);
this.support.firePropertyChange (ClassPathImplementation.PROP_RESOURCES,null,null);
diff --git a/ide/api.java.classpath/test/unit/src/org/netbeans/api/java/queries/BinaryForSourceQueryTest.java b/ide/api.java.classpath/test/unit/src/org/netbeans/api/java/queries/BinaryForSourceQueryTest.java
index dd036da..d64d5b2 100644
--- a/ide/api.java.classpath/test/unit/src/org/netbeans/api/java/queries/BinaryForSourceQueryTest.java
+++ b/ide/api.java.classpath/test/unit/src/org/netbeans/api/java/queries/BinaryForSourceQueryTest.java
@@ -52,7 +52,7 @@
@Override
protected void setUp () throws IOException {
- MockServices.setServices(new Class[] {CPProvider.class, SFBQImpl.class});
+ MockServices.setServices(new Class<?>[] {CPProvider.class, SFBQImpl.class});
this.clearWorkDir();
File wd = this.getWorkDir();
FileObject root = FileUtil.toFileObject(wd);
diff --git a/ide/api.java.classpath/test/unit/src/org/netbeans/api/java/queries/SourceForBinaryQueryTest.java b/ide/api.java.classpath/test/unit/src/org/netbeans/api/java/queries/SourceForBinaryQueryTest.java
index 1b358b1..05edd10 100644
--- a/ide/api.java.classpath/test/unit/src/org/netbeans/api/java/queries/SourceForBinaryQueryTest.java
+++ b/ide/api.java.classpath/test/unit/src/org/netbeans/api/java/queries/SourceForBinaryQueryTest.java
@@ -177,7 +177,7 @@
fired.set(true);
}
});
- ((LeafSFBQImpl)DelegatingSFBImpl.impl).lastResult.fire();
+ LeafSFBQImpl.lastResult.fire();
res.removeChangeListener(l);
assertTrue(fired.get());
}
@@ -217,14 +217,14 @@
public Result findSourceRoots2(URL binaryRoot) {
- if (this.impl == null) {
+ if (DelegatingSFBImpl.impl == null) {
throw new IllegalStateException ();
}
- else if (this.impl instanceof SourceForBinaryQueryImplementation2) {
- return ((SourceForBinaryQueryImplementation2)this.impl).findSourceRoots2(binaryRoot);
+ else if (DelegatingSFBImpl.impl instanceof SourceForBinaryQueryImplementation2) {
+ return ((SourceForBinaryQueryImplementation2)DelegatingSFBImpl.impl).findSourceRoots2(binaryRoot);
}
else {
- final SourceForBinaryQuery.Result result = this.impl.findSourceRoots(binaryRoot);
+ final SourceForBinaryQuery.Result result = DelegatingSFBImpl.impl.findSourceRoots(binaryRoot);
return result == null ? null : asResult(result);
}
}
diff --git a/ide/bugtracking.commons/src/org/netbeans/modules/bugtracking/issuetable/IssueNode.java b/ide/bugtracking.commons/src/org/netbeans/modules/bugtracking/issuetable/IssueNode.java
index 7e5b0bb..43e35cd 100644
--- a/ide/bugtracking.commons/src/org/netbeans/modules/bugtracking/issuetable/IssueNode.java
+++ b/ide/bugtracking.commons/src/org/netbeans/modules/bugtracking/issuetable/IssueNode.java
@@ -259,7 +259,7 @@
return IssueNode.this.getSummary();
}
@Override
- public int compareTo(IssueProperty p) {
+ public int compareTo(IssueProperty<String> p) {
if(p == null) return 1;
String s1 = IssueNode.this.getSummary();
String s2 = p.getSummary();
@@ -282,7 +282,7 @@
return issueImpl.getStatus() == IssueStatusProvider.Status.SEEN;
}
@Override
- public int compareTo(IssueProperty p) {
+ public int compareTo(IssueProperty<Boolean> p) {
if(p == null) return 1;
Boolean b1 = IssueNode.this.wasSeen();
Boolean b2 = p.getStatus() == IssueStatusProvider.Status.SEEN;
diff --git a/ide/bugtracking.commons/src/org/netbeans/modules/bugtracking/issuetable/IssueTable.java b/ide/bugtracking.commons/src/org/netbeans/modules/bugtracking/issuetable/IssueTable.java
index e341949..be01210 100644
--- a/ide/bugtracking.commons/src/org/netbeans/modules/bugtracking/issuetable/IssueTable.java
+++ b/ide/bugtracking.commons/src/org/netbeans/modules/bugtracking/issuetable/IssueTable.java
@@ -24,7 +24,6 @@
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.TableColumnModelEvent;
import javax.swing.table.TableColumn;
-import org.netbeans.modules.bugtracking.issuetable.IssueNode.IssueProperty;
import org.openide.util.NbBundle;
import javax.swing.event.AncestorListener;
import javax.swing.event.AncestorEvent;
@@ -114,9 +113,9 @@
private final FindInQuerySupport findInQuerySupport;
private boolean isSaved;
- private static final Comparator<IssueProperty> nodeComparator = new Comparator<IssueProperty>() {
+ private static final Comparator<IssueNode<Object>.IssueProperty<Object>> nodeComparator = new Comparator<IssueNode<Object>.IssueProperty<Object>>() {
@Override
- public int compare(IssueProperty p1, IssueProperty p2) {
+ public int compare(IssueNode<Object>.IssueProperty<Object> p1, IssueNode<Object>.IssueProperty<Object> p2) {
Integer sk1 = (Integer) p1.getValue("sortkey"); // NOI18N
if (sk1 != null) {
Integer sk2 = (Integer) p2.getValue("sortkey"); // NOI18N
diff --git a/ide/bugtracking.commons/src/org/netbeans/modules/bugtracking/issuetable/QueryTableCellRenderer.java b/ide/bugtracking.commons/src/org/netbeans/modules/bugtracking/issuetable/QueryTableCellRenderer.java
index a132c5e..be7b5ed 100644
--- a/ide/bugtracking.commons/src/org/netbeans/modules/bugtracking/issuetable/QueryTableCellRenderer.java
+++ b/ide/bugtracking.commons/src/org/netbeans/modules/bugtracking/issuetable/QueryTableCellRenderer.java
@@ -292,7 +292,7 @@
}
- public static TableCellStyle getCellStyle(JTable table, IssueTable issueTable, IssueProperty p, boolean isSelected, int row) {
+ public static TableCellStyle getCellStyle(JTable table, IssueTable issueTable, IssueNode<?>.IssueProperty<?> p, boolean isSelected, int row) {
TableCellStyle style = getDefaultCellStyle(table, issueTable, p, isSelected, row);
try {
// set text format and background depending on selection and issue status
@@ -343,7 +343,7 @@
}
return style;
}
- public static TableCellStyle getDefaultCellStyle(JTable table, IssueTable issueTable, IssueProperty p, boolean isSelected, int row) {
+ public static TableCellStyle getDefaultCellStyle(JTable table, IssueTable issueTable, IssueNode<?>.IssueProperty<?> p, boolean isSelected, int row) {
// set default values
return new TableCellStyle(
null, // format
@@ -354,7 +354,7 @@
);
}
- private static Pattern getHightlightPattern(IssueTable issueTable, IssueProperty p) {
+ private static Pattern getHightlightPattern(IssueTable issueTable, IssueNode<?>.IssueProperty<?> p) {
if(p instanceof IssueNode.SummaryProperty) {
SummaryTextFilter f = issueTable.getSummaryFilter();
if(f != null && f.isHighLightingOn()) {
diff --git a/ide/bugtracking.commons/test/unit/src/org/netbeans/modules/bugtracking/issuetable/QueryTableCellRendererTest.java b/ide/bugtracking.commons/test/unit/src/org/netbeans/modules/bugtracking/issuetable/QueryTableCellRendererTest.java
index 28ceca8..7854bb1 100644
--- a/ide/bugtracking.commons/test/unit/src/org/netbeans/modules/bugtracking/issuetable/QueryTableCellRendererTest.java
+++ b/ide/bugtracking.commons/test/unit/src/org/netbeans/modules/bugtracking/issuetable/QueryTableCellRendererTest.java
@@ -98,7 +98,7 @@
// issue seen, not selected
RendererIssue rendererIssue = new RendererIssue(rendererRepository, "");
- IssueProperty property = new RendererNode(rendererIssue, "some value", rendererRepository).createProperty();
+ RendererNode.RendererIssueProperty property = new RendererNode(rendererIssue, "some value", rendererRepository).createProperty();
rendererQuery.containsIssue = true;
boolean selected = false;
setIssueValues(rendererRepository, rendererIssue, Status.SEEN, true);
@@ -188,7 +188,7 @@
RendererRepository rendererRepository = new RendererRepository();
RendererIssue issue = new RendererIssue(rendererRepository, "");
RendererQuery query = new RendererQuery(rendererRepository);
- IssueProperty property = new RendererNode(issue, "some value", rendererRepository).createProperty();
+ RendererNode.RendererIssueProperty property = new RendererNode(issue, "some value", rendererRepository).createProperty();
IssueTable issueTable = new IssueTable(
TestKit.getRepository(rendererRepository).getId(),
@@ -265,7 +265,7 @@
}
}
- private class RendererNode<TestIssue> extends IssueNode {
+ private class RendererNode extends IssueNode<TestIssue> {
Object propertyValue;
public RendererNode(RendererIssue issue, String value, RendererRepository rendererRepository) {
@@ -279,8 +279,8 @@
protected Property<?>[] getProperties() {
return new Property[0];
}
- class RendererIssueProperty extends IssueProperty {
- public RendererIssueProperty(String arg0, Class name, String type, String displayName, Object value) {
+ class RendererIssueProperty extends IssueProperty<Object> {
+ public RendererIssueProperty(String arg0, Class<Object> name, String type, String displayName, Object value) {
super(arg0, name, type, displayName);
}
@Override
diff --git a/javafx/javafx2.scenebuilder/src/org/netbeans/modules/javafx2/scenebuilder/options/GrowingComboBox.java b/javafx/javafx2.scenebuilder/src/org/netbeans/modules/javafx2/scenebuilder/options/GrowingComboBox.java
index 45b29cb..69a2cef 100644
--- a/javafx/javafx2.scenebuilder/src/org/netbeans/modules/javafx2/scenebuilder/options/GrowingComboBox.java
+++ b/javafx/javafx2.scenebuilder/src/org/netbeans/modules/javafx2/scenebuilder/options/GrowingComboBox.java
@@ -37,7 +37,7 @@
*/
public class GrowingComboBox extends javax.swing.JPanel {
private static final String SEPARATOR = "---";
- final public static class GrowingListModel<T> implements ComboBoxModel {
+ public static final class GrowingListModel<T> implements ComboBoxModel<Object> {
final private Set<ListDataListener> listeners = new CopyOnWriteArraySet<ListDataListener>();
final private List<T> predefinedList = new ArrayList<T>();
final private List<T> userList = new ArrayList<T>();
@@ -244,7 +244,7 @@
return super.getListCellRendererComponent(list, s, index, isSelected, cellHasFocus);
}
});
- combo.setModel(new GrowingListModel());
+ combo.setModel(new GrowingListModel<Object>());
}
/**
diff --git a/platform/api.search/nbproject/project.properties b/platform/api.search/nbproject/project.properties
index 6a8c641..7a4e8cb 100644
--- a/platform/api.search/nbproject/project.properties
+++ b/platform/api.search/nbproject/project.properties
@@ -16,6 +16,6 @@
# under the License.
is.autoload=true
javac.source=1.8
-javac.compilerargs=-Xlint -Xlint:-serial
+javac.compilerargs=-Xlint:all -Xlint:-serial
javadoc.arch=${basedir}/arch.xml
javadoc.apichanges=${basedir}/apichanges.xml
diff --git a/platform/api.search/src/org/netbeans/modules/search/GraphicalSearchListener.java b/platform/api.search/src/org/netbeans/modules/search/GraphicalSearchListener.java
index 755c691..7501f64 100644
--- a/platform/api.search/src/org/netbeans/modules/search/GraphicalSearchListener.java
+++ b/platform/api.search/src/org/netbeans/modules/search/GraphicalSearchListener.java
@@ -82,17 +82,13 @@
}
public void searchStarted() {
-
progressHandle = ProgressHandleFactory.createHandle(
- NbBundle.getMessage(ResultView.class,
- "TEXT_SEARCHING___"), new Cancellable() { //NOI18N
-
- @Override
- public boolean cancel() {
- searchComposition.terminate();
- return true;
- }
- });
+ NbBundle.getMessage(ResultView.class, "TEXT_SEARCHING___"), //NOI18N
+ () -> {
+ searchComposition.terminate();
+ return true;
+ },
+ null);
progressHandle.start();
resultViewPanel.searchStarted();
searchComposition.getSearchResultsDisplayer().searchStarted();
diff --git a/platform/api.search/src/org/netbeans/modules/search/ReplaceTask.java b/platform/api.search/src/org/netbeans/modules/search/ReplaceTask.java
index 931336d..82dfc38 100644
--- a/platform/api.search/src/org/netbeans/modules/search/ReplaceTask.java
+++ b/platform/api.search/src/org/netbeans/modules/search/ReplaceTask.java
@@ -72,7 +72,8 @@
problems = new ArrayList<String>(4);
progressHandle = ProgressHandleFactory.createHandle(
- NbBundle.getMessage(getClass(), "LBL_Replacing")); //NOI18N
+ NbBundle.getMessage(getClass(), "LBL_Replacing"), //NOI18N
+ null, null);
}
/**
diff --git a/platform/api.search/src/org/netbeans/modules/search/ui/FileObjectPropertySet.java b/platform/api.search/src/org/netbeans/modules/search/ui/FileObjectPropertySet.java
index e889edc..e21e7a3 100644
--- a/platform/api.search/src/org/netbeans/modules/search/ui/FileObjectPropertySet.java
+++ b/platform/api.search/src/org/netbeans/modules/search/ui/FileObjectPropertySet.java
@@ -30,8 +30,8 @@
*/
public class FileObjectPropertySet extends Node.PropertySet {
- private FileObject fileObject;
- Property[] properties;
+ private final FileObject fileObject;
+ private final Property<?>[] properties;
public FileObjectPropertySet(FileObject fileObject) {
this.fileObject = fileObject;
diff --git a/platform/api.search/test/unit/src/org/netbeans/api/search/SearchHistoryTest.java b/platform/api.search/test/unit/src/org/netbeans/api/search/SearchHistoryTest.java
index 07b64b9..ddda5ca 100644
--- a/platform/api.search/test/unit/src/org/netbeans/api/search/SearchHistoryTest.java
+++ b/platform/api.search/test/unit/src/org/netbeans/api/search/SearchHistoryTest.java
@@ -61,6 +61,7 @@
assertTrue(SearchHistory.getDefault().getSearchPatterns().size() == 10);
}
+ @SuppressWarnings("deprecation") // tests deprecated APIs
public void testLastSelectedListener() throws Exception{
final boolean fired[] = new boolean[1];
fired[0] = false;
diff --git a/platform/api.search/test/unit/src/org/netbeans/api/search/ui/SearchPatternControllerTest.java b/platform/api.search/test/unit/src/org/netbeans/api/search/ui/SearchPatternControllerTest.java
index ce55da7..a4246cc 100644
--- a/platform/api.search/test/unit/src/org/netbeans/api/search/ui/SearchPatternControllerTest.java
+++ b/platform/api.search/test/unit/src/org/netbeans/api/search/ui/SearchPatternControllerTest.java
@@ -35,10 +35,10 @@
@Test
public void testBindComboBox() {
- JComboBox cb = new JComboBox();
+ JComboBox<?> cb = new JComboBox<>();
SearchPatternController controller =
ComponentUtils.adjustComboForSearchPattern(cb);
- JComboBox matchTypeCb = new JComboBox(new Object[]{
+ JComboBox<MatchType> matchTypeCb = new JComboBox<>(new MatchType[]{
MatchType.BASIC, MatchType.LITERAL, MatchType.REGEXP});
assertEquals(MatchType.BASIC, matchTypeCb.getSelectedItem());
controller.bindMatchTypeComboBox(matchTypeCb);
@@ -110,10 +110,10 @@
private void checkExceptionsWhenEnsuringItemsAreCorrect(
boolean exceptionExpected, String message, Object... comboItems) {
- JComboBox cb = new JComboBox();
+ JComboBox<?> cb = new JComboBox<>();
SearchPatternController controller =
ComponentUtils.adjustComboForSearchPattern(cb);
- JComboBox matchTypeCb = new JComboBox(comboItems);
+ JComboBox<?> matchTypeCb = new JComboBox<>(comboItems);
boolean thrown = false;
try {
controller.bindMatchTypeComboBox(matchTypeCb);
@@ -125,11 +125,11 @@
@Test
public void testMatchTypeComboBoxWithUnsupportedTypes() {
- JComboBox cb = new JComboBox();
+ JComboBox<?> cb = new JComboBox<>();
SearchPatternController controller =
ComponentUtils.adjustComboForSearchPattern(cb);
- JComboBox matchTypeCb = new JComboBox(
- new Object[]{MatchType.LITERAL, MatchType.REGEXP});
+ JComboBox<MatchType> matchTypeCb = new JComboBox<>(
+ new MatchType[]{MatchType.LITERAL, MatchType.REGEXP});
controller.bindMatchTypeComboBox(matchTypeCb);
assertEquals(MatchType.LITERAL, matchTypeCb.getSelectedItem());
controller.setSearchPattern(SearchPattern.create("test", false, false,
diff --git a/platform/api.search/test/unit/src/org/netbeans/modules/search/matcher/BufferedCharSequenceTest.java b/platform/api.search/test/unit/src/org/netbeans/modules/search/matcher/BufferedCharSequenceTest.java
index 5c22f72..012d0b3 100644
--- a/platform/api.search/test/unit/src/org/netbeans/modules/search/matcher/BufferedCharSequenceTest.java
+++ b/platform/api.search/test/unit/src/org/netbeans/modules/search/matcher/BufferedCharSequenceTest.java
@@ -121,6 +121,7 @@
private int getLenght(TypeOfStream stype, TypeOfContent ctype, Charset cs, int size){
InputStream stream = getInputStream(stype, ctype, cs);
+ @SuppressWarnings("deprecation")
BufferedCharSequence instance = new BufferedCharSequence(stream, cs.newDecoder(), size);
instance.setMaxBufferSize(10);
return instance.length();
@@ -136,6 +137,7 @@
int index = 0;
Charset cs = Charset.forName(UTF_8);
InputStream stream = getInputStream(TypeOfStream.FILE, TypeOfContent.BYTE_0, cs);
+ @SuppressWarnings("deprecation")
BufferedCharSequence instance = new BufferedCharSequence(stream, cs.newDecoder(), 0);
instance.charAt(index);
}
@@ -149,6 +151,7 @@
int index = 0;
Charset cs = Charset.forName(UTF_8);
InputStream stream = getInputStream(TypeOfStream.BYTE, TypeOfContent.BYTE_0, cs);
+ @SuppressWarnings("deprecation")
BufferedCharSequence instance = new BufferedCharSequence(stream, cs.newDecoder(), 0);
instance.charAt(index);
}
@@ -162,6 +165,7 @@
for(TypeOfStream stype: TypeOfStream.values()) {
try {
InputStream stream = getInputStream(stype, TypeOfContent.BYTE_1, cs);
+ @SuppressWarnings("deprecation")
BufferedCharSequence instance = new BufferedCharSequence(stream, cs.newDecoder(), 1);
char expResult = 'a';
char result = instance.charAt(index);
@@ -185,6 +189,7 @@
Charset cs = Charset.forName(UTF_8);
for(TypeOfStream stype: TypeOfStream.values()) {
InputStream stream = getInputStream(stype, TypeOfContent.BYTE_10, cs);
+ @SuppressWarnings("deprecation")
BufferedCharSequence instance = new BufferedCharSequence(stream, cs.newDecoder(), 10);
instance.setMaxBufferSize(10);
char result;
@@ -210,6 +215,7 @@
Charset cs = Charset.forName(UTF_8);
for(TypeOfStream stype: TypeOfStream.values()) {
InputStream stream = getInputStream(stype, TypeOfContent.BYTE_10, cs);
+ @SuppressWarnings("deprecation")
BufferedCharSequence instance = new BufferedCharSequence(stream, cs.newDecoder(), 10);
instance.setMaxBufferSize(5);
char result;
@@ -253,6 +259,7 @@
System.out.println("toString");
for(TypeOfStream stype: TypeOfStream.values()) {
InputStream stream = getInputStream(stype, TypeOfContent.BYTE_10, cs_UTF_8);
+ @SuppressWarnings("deprecation")
BufferedCharSequence instance = new BufferedCharSequence(stream, cs_UTF_8.newDecoder(), 10);
instance.setMaxBufferSize(5);
String expResult = TypeOfContent.BYTE_10.getContent();
@@ -312,6 +319,7 @@
System.out.println("nextLineText@no line terminators in the file.");
for(TypeOfStream stype: TypeOfStream.values()) {
InputStream stream = getInputStream(stype, TypeOfContent.BYTE_10, cs_UTF_8);
+ @SuppressWarnings("deprecation")
BufferedCharSequence instance = new BufferedCharSequence(stream, cs_UTF_8.newDecoder(), 10);
assertEquals(0, instance.position());
String expResult = TypeOfContent.BYTE_10.getContent();
diff --git a/platform/api.search/test/unit/src/org/netbeans/modules/search/matcher/SearchPerformanceComparator.form b/platform/api.search/test/unit/src/org/netbeans/modules/search/matcher/SearchPerformanceComparator.form
index e94d3f4..c2cb94b 100644
--- a/platform/api.search/test/unit/src/org/netbeans/modules/search/matcher/SearchPerformanceComparator.form
+++ b/platform/api.search/test/unit/src/org/netbeans/modules/search/matcher/SearchPerformanceComparator.form
@@ -27,6 +27,7 @@
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
+ <SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
@@ -179,6 +180,9 @@
</StringArray>
</Property>
</Properties>
+ <AuxValues>
+ <AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<String>"/>
+ </AuxValues>
</Component>
<Component class="javax.swing.JLabel" name="jLabel4">
<Properties>
diff --git a/platform/api.search/test/unit/src/org/netbeans/modules/search/matcher/SearchPerformanceComparator.java b/platform/api.search/test/unit/src/org/netbeans/modules/search/matcher/SearchPerformanceComparator.java
index 58c0fee..21ac06f 100644
--- a/platform/api.search/test/unit/src/org/netbeans/modules/search/matcher/SearchPerformanceComparator.java
+++ b/platform/api.search/test/unit/src/org/netbeans/modules/search/matcher/SearchPerformanceComparator.java
@@ -63,7 +63,7 @@
jLabel2 = new javax.swing.JLabel();
regexpTextField = new javax.swing.JTextField();
jLabel3 = new javax.swing.JLabel();
- matcherComboBox = new javax.swing.JComboBox();
+ matcherComboBox = new javax.swing.JComboBox<>();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
@@ -91,7 +91,7 @@
jLabel3.setText(org.openide.util.NbBundle.getMessage(SearchPerformanceComparator.class, "SearchPerformanceComparator.jLabel3.text")); // NOI18N
- matcherComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Default (ML: BufferedCharSequence, SL: LineReader)", "MultiLineMappedMatcherBig", "MultiLineMappedMatcherSmall", "MultiLineStreamMatcher", "SingleLineStreamMatcher", "Iterator", "AsciiMultiLineMappedMatcher" }));
+ matcherComboBox.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Default (ML: BufferedCharSequence, SL: LineReader)", "MultiLineMappedMatcherBig", "MultiLineMappedMatcherSmall", "MultiLineStreamMatcher", "SingleLineStreamMatcher", "Iterator", "AsciiMultiLineMappedMatcher" }));
jLabel4.setText(org.openide.util.NbBundle.getMessage(SearchPerformanceComparator.class, "SearchPerformanceComparator.jLabel4.text")); // NOI18N
@@ -328,7 +328,7 @@
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
- private javax.swing.JComboBox matcherComboBox;
+ private javax.swing.JComboBox<String> matcherComboBox;
private javax.swing.JLabel matchesLabel;
private javax.swing.JTextField regexpTextField;
private javax.swing.JTextField rootTextField;
diff --git a/platform/api.search/test/unit/src/org/netbeans/spi/search/SearchScopeDefinitionTest.java b/platform/api.search/test/unit/src/org/netbeans/spi/search/SearchScopeDefinitionTest.java
index 5ad47dc..d374fc6 100644
--- a/platform/api.search/test/unit/src/org/netbeans/spi/search/SearchScopeDefinitionTest.java
+++ b/platform/api.search/test/unit/src/org/netbeans/spi/search/SearchScopeDefinitionTest.java
@@ -18,11 +18,10 @@
*/
package org.netbeans.spi.search;
-import java.util.TimerTask;
import java.util.concurrent.Semaphore;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
-import static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.assertEquals;
import org.junit.Test;
import org.netbeans.api.search.provider.SearchInfo;
import org.openide.util.Exceptions;
diff --git a/platform/core.network/src/org/netbeans/core/network/utils/LocalAddressUtils.java b/platform/core.network/src/org/netbeans/core/network/utils/LocalAddressUtils.java
index 660c6b6..68aa14f 100644
--- a/platform/core.network/src/org/netbeans/core/network/utils/LocalAddressUtils.java
+++ b/platform/core.network/src/org/netbeans/core/network/utils/LocalAddressUtils.java
@@ -100,34 +100,21 @@
private static Future<InetAddress[]> fut2;
private static Future<List<InetAddress>> fut3;
- private static final Callable<InetAddress> C1 = new Callable<InetAddress>(){
- @Override
- public InetAddress call() throws UnknownHostException {
- return InetAddress.getLocalHost();
+ private static final Callable<InetAddress> C1 = () -> InetAddress.getLocalHost();
+ private static final Callable<InetAddress[]> C2 = () -> {
+ try {
+ String hostname = HostnameUtils.getNetworkHostname();
+ return InetAddress.getAllByName(hostname);
+ } catch (NativeException ex) {
+ throw new UnknownHostException(ex.getMessage() + ", error code : " + ex.getErrorCode());
}
};
- private static final Callable<InetAddress[]> C2 = new Callable<InetAddress[]>(){
- @Override
- public InetAddress[] call() throws UnknownHostException {
- try {
- String hostname = HostnameUtils.getNetworkHostname();
- return InetAddress.getAllByName(hostname);
- } catch (NativeException ex) {
- throw new UnknownHostException(ex.getMessage() + ", error code : " + ex.getErrorCode());
- }
- }
- };
- private static final Callable<List<InetAddress>> C3 = new Callable<List<InetAddress>>(){
- @Override
- public List<InetAddress> call() {
- return getLocalNetworkInterfaceAddr();
- }
- };
+ private static final Callable<List<InetAddress>> C3 = () -> getLocalNetworkInterfaceAddr();
+
static {
refreshNetworkInfo(false);
}
-
private LocalAddressUtils() {
}
diff --git a/platform/o.n.bootstrap/nbproject/project.properties b/platform/o.n.bootstrap/nbproject/project.properties
index 84ae088..f30c9e4 100644
--- a/platform/o.n.bootstrap/nbproject/project.properties
+++ b/platform/o.n.bootstrap/nbproject/project.properties
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
-javac.compilerargs=-Xlint -Xlint:-serial
+javac.compilerargs=-Xlint:all -Xlint:-serial -Xlint:-processing -Werror
javac.source=1.8
module.jar.dir=lib
module.jar.basename=boot.jar
diff --git a/platform/o.n.bootstrap/src/org/netbeans/FixedModule.java b/platform/o.n.bootstrap/src/org/netbeans/FixedModule.java
index 1df3d7e..9628d1a 100644
--- a/platform/o.n.bootstrap/src/org/netbeans/FixedModule.java
+++ b/platform/o.n.bootstrap/src/org/netbeans/FixedModule.java
@@ -219,7 +219,7 @@
/** Turn on the classloader. Passed a list of parent modules to use.
* The parents should already have had their classloaders initialized.
*/
- protected void classLoaderUp(Set parents) throws IOException {
+ protected void classLoaderUp(Set<Module> parents) throws IOException {
return; // no need
}
diff --git a/platform/o.n.bootstrap/src/org/netbeans/JarClassLoader.java b/platform/o.n.bootstrap/src/org/netbeans/JarClassLoader.java
index 728ee34..147c4ef 100644
--- a/platform/o.n.bootstrap/src/org/netbeans/JarClassLoader.java
+++ b/platform/o.n.bootstrap/src/org/netbeans/JarClassLoader.java
@@ -205,7 +205,7 @@
}
@Override
- protected Class doLoadClass(String pkgName, String name) {
+ protected Class<?> doLoadClass(String pkgName, String name) {
String path = name.replace('.', '/').concat(".class"); // NOI18N
// look up the Sources and return a class based on their content
@@ -1139,6 +1139,7 @@
return new JarFile(src.file); // #134424
}
+ @SuppressWarnings("rawtypes")
public @Override Object getContent(Class[] classes) throws IOException {
if (Arrays.asList(classes).contains(ClassLoader.class)) {
return loader;
diff --git a/platform/o.n.bootstrap/src/org/netbeans/Module.java b/platform/o.n.bootstrap/src/org/netbeans/Module.java
index 55acae8..9ac12a2 100644
--- a/platform/o.n.bootstrap/src/org/netbeans/Module.java
+++ b/platform/o.n.bootstrap/src/org/netbeans/Module.java
@@ -567,7 +567,9 @@
findResources.setAccessible(true);
}
ClassLoader cl = getClassLoader();
- return (Enumeration<URL>) findResources.invoke(cl, resources); // NOI18N
+ @SuppressWarnings("unchecked")
+ Enumeration<URL> en = (Enumeration<URL>) findResources.invoke(cl, resources); // NOI18N
+ return en;
} catch (Exception x) {
Exceptions.printStackTrace(x);
return Enumerations.empty();
diff --git a/platform/o.n.bootstrap/src/org/netbeans/ModuleInstaller.java b/platform/o.n.bootstrap/src/org/netbeans/ModuleInstaller.java
index c31cf7d..7ed95db 100644
--- a/platform/o.n.bootstrap/src/org/netbeans/ModuleInstaller.java
+++ b/platform/o.n.bootstrap/src/org/netbeans/ModuleInstaller.java
@@ -191,7 +191,7 @@
* @since org.netbeans.core/1 > 1.6
* @see "#27853"
*/
- public void refineClassLoader(Module m, List parents) {
+ public void refineClassLoader(Module m, List<? extends ClassLoader> parents) {
// do nothing
}
diff --git a/platform/o.n.bootstrap/src/org/netbeans/ModuleManager.java b/platform/o.n.bootstrap/src/org/netbeans/ModuleManager.java
index af7fcdd..98f1990 100644
--- a/platform/o.n.bootstrap/src/org/netbeans/ModuleManager.java
+++ b/platform/o.n.bootstrap/src/org/netbeans/ModuleManager.java
@@ -299,7 +299,7 @@
return completeLookup;
}
// Access from ChangeFirer:
- final void fireModulesCreatedDeleted(Set created, Set deleted) {
+ final void fireModulesCreatedDeleted(Set<Module> created, Set<Module> deleted) {
if (Util.err.isLoggable(Level.FINE)) {
Util.err.fine("lookup created: " + created + " deleted: " + deleted);
}
@@ -311,7 +311,7 @@
* @see #PROP_MODULES
*/
public Set<Module> getModules() {
- return new HashSet<Module>(modules);
+ return new HashSet<>(modules);
}
final int getModuleCount() {
@@ -731,7 +731,7 @@
}
@Override
- protected synchronized Class loadClass(String name, boolean resolve) throws ClassNotFoundException {
+ protected synchronized Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
ProxyClassLoader priviledged = null;
NetigsoLoader osgi = null;
if (!name.startsWith("java.")) { // NOI18N
@@ -896,7 +896,7 @@
return installer.refineProvides (m);
}
/** Used by Module to communicate with the ModuleInstaller re. classloader. */
- public ClassLoader refineClassLoader(Module m, List parents) {
+ public ClassLoader refineClassLoader(Module m, List<? extends ClassLoader> parents) {
// #27853:
installer.refineClassLoader(m, parents);
// if fragment, integrate into the host's classloader. Should be called under mutex()
diff --git a/platform/o.n.bootstrap/src/org/netbeans/NbInstrumentation.java b/platform/o.n.bootstrap/src/org/netbeans/NbInstrumentation.java
index 971f5bd..15b3731 100644
--- a/platform/o.n.bootstrap/src/org/netbeans/NbInstrumentation.java
+++ b/platform/o.n.bootstrap/src/org/netbeans/NbInstrumentation.java
@@ -151,11 +151,13 @@
return false;
}
+ @SuppressWarnings("rawtypes")
@Override
public Class[] getAllLoadedClasses() {
return new Class[0];
}
+ @SuppressWarnings("rawtypes")
@Override
public Class[] getInitiatedClasses(ClassLoader loader) {
return new Class[0];
diff --git a/platform/o.n.bootstrap/src/org/netbeans/NetigsoHandle.java b/platform/o.n.bootstrap/src/org/netbeans/NetigsoHandle.java
index 812e9f1..3c05082 100644
--- a/platform/o.n.bootstrap/src/org/netbeans/NetigsoHandle.java
+++ b/platform/o.n.bootstrap/src/org/netbeans/NetigsoHandle.java
@@ -166,7 +166,9 @@
}
List<Module> clone;
synchronized (toEnable) {
- clone = (List<Module>) toEnable.clone();
+ @SuppressWarnings("unchecked")
+ List<Module> cloneTmp = (List<Module>) toEnable.clone();
+ clone = cloneTmp;
toEnable.clear();
}
if (!clone.isEmpty()) {
@@ -196,7 +198,7 @@
ClassLoader frameworkLoader = f.findFrameworkClassLoader();
- Class[] stack = TopSecurityManager.getStack();
+ Class<?>[] stack = TopSecurityManager.getStack();
for (int i = 0; i < stack.length; i++) {
ClassLoader sl = stack[i].getClassLoader();
if (sl == null) {
diff --git a/platform/o.n.bootstrap/src/org/netbeans/NetigsoModule.java b/platform/o.n.bootstrap/src/org/netbeans/NetigsoModule.java
index 89cdcd2..29eb2ae 100644
--- a/platform/o.n.bootstrap/src/org/netbeans/NetigsoModule.java
+++ b/platform/o.n.bootstrap/src/org/netbeans/NetigsoModule.java
@@ -241,7 +241,7 @@
}
@Override
- protected Class loadClass(String name, boolean resolve) throws ClassNotFoundException {
+ protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
try {
return delegate().loadClass(name, resolve);
} catch (IllegalStateException ex) {
diff --git a/platform/o.n.bootstrap/src/org/netbeans/PatchByteCode.java b/platform/o.n.bootstrap/src/org/netbeans/PatchByteCode.java
index 2385936..12c615d 100644
--- a/platform/o.n.bootstrap/src/org/netbeans/PatchByteCode.java
+++ b/platform/o.n.bootstrap/src/org/netbeans/PatchByteCode.java
@@ -88,6 +88,7 @@
Properties props = new Properties();
props.load(new InputStreamReader(istm, "UTF-8")); // NOI18N
+ @SuppressWarnings("unchecked")
Enumeration<String> en = (Enumeration<String>)props.propertyNames();
while (en.hasMoreElements()) {
diff --git a/platform/o.n.bootstrap/src/org/netbeans/ProxyClassLoader.java b/platform/o.n.bootstrap/src/org/netbeans/ProxyClassLoader.java
index cdc090b..e64180d 100644
--- a/platform/o.n.bootstrap/src/org/netbeans/ProxyClassLoader.java
+++ b/platform/o.n.bootstrap/src/org/netbeans/ProxyClassLoader.java
@@ -120,9 +120,9 @@
* @exception ClassNotFoundException if the class could not be found
*/
@Override
- protected synchronized Class loadClass(String name, boolean resolve)
+ protected synchronized Class<?> loadClass(String name, boolean resolve)
throws ClassNotFoundException {
- final Class cls = doFindClass(name);
+ final Class<?> cls = doFindClass(name);
if (resolve) resolveClass(cls);
return cls;
}
@@ -239,7 +239,7 @@
private static final Set<String> arbitraryLoadWarnings = Collections.synchronizedSet(new HashSet<String>());
/** May return null */
- private synchronized Class selfLoadClass(String pkg, String name) {
+ private synchronized Class<?> selfLoadClass(String pkg, String name) {
Class<?> cls = findLoadedClass(name);
if (cls == null) {
try {
@@ -265,7 +265,7 @@
* @param name the name of the class
* @return the resulting <code>Class</code> object or <code>null</code>
*/
- protected Class doLoadClass(String pkg, String name) {
+ protected Class<?> doLoadClass(String pkg, String name) {
return null;
}
diff --git a/platform/o.n.bootstrap/src/org/netbeans/Stamps.java b/platform/o.n.bootstrap/src/org/netbeans/Stamps.java
index 7777f1d..1dfb877 100644
--- a/platform/o.n.bootstrap/src/org/netbeans/Stamps.java
+++ b/platform/o.n.bootstrap/src/org/netbeans/Stamps.java
@@ -986,7 +986,8 @@
dos.writeUTF(codeName);
dos.writeUTF(relPath);
} else {
- Collection coll = (Collection) out;
+ @SuppressWarnings("unchecked")
+ Collection<String> coll = (Collection<String>) out;
coll.add(codeName);
coll.add(relPath);
}
diff --git a/platform/o.n.bootstrap/src/org/netbeans/TopSecurityManager.java b/platform/o.n.bootstrap/src/org/netbeans/TopSecurityManager.java
index 71cccf1..babb04d 100644
--- a/platform/o.n.bootstrap/src/org/netbeans/TopSecurityManager.java
+++ b/platform/o.n.bootstrap/src/org/netbeans/TopSecurityManager.java
@@ -165,7 +165,7 @@
}
static boolean officialExit = false;
- static Class[] getStack() {
+ static Class<?>[] getStack() {
SecurityManager s = System.getSecurityManager();
TopSecurityManager t;
if (s instanceof TopSecurityManager) {
@@ -197,6 +197,7 @@
super.checkExit(status);
}
+ @SuppressWarnings("deprecation")
public boolean checkTopLevelWindow(Object window) {
return checkTopLevelWindow(new AWTPermission("showWindowWithoutWarningBanner"), window); // NOI18N
}
@@ -387,6 +388,7 @@
private final Set<Class<?>> warnedSunMisc = new WeakSet<>();
private final Set<String> callerWhiteList = createCallerWhiteList();
+ @SuppressWarnings("deprecation")
public void checkMemberAccess(Class<?> clazz, int which) {
final String n = clazz.getName();
if (n.startsWith("sun.misc")) { // NOI18N
@@ -570,7 +572,7 @@
// }
// }
//
- private Class getInsecureClass() {
+ private Class<?> getInsecureClass() {
Class<?>[] ctx = getClassContext();
boolean firstACClass = false;
@@ -607,7 +609,7 @@
}
/** Checks if the class is loaded through the nbfs URL */
- static boolean isSecureClass(final Class clazz) {
+ static boolean isSecureClass(final Class<?> clazz) {
URL source = getClassURL(clazz);
if (source != null) {
return isSecureProtocol(source.getProtocol());
@@ -618,7 +620,7 @@
/** @return a protocol through which was the class loaded (file://...) or null
*/
- static URL getClassURL(Class clazz) {
+ static URL getClassURL(Class<?> clazz) {
java.security.CodeSource cs = clazz.getProtectionDomain().getCodeSource();
if (cs != null) {
URL url = cs.getLocation();
@@ -628,7 +630,7 @@
}
}
- static Field getUrlField(Class clazz) {
+ static Field getUrlField(Class<?> clazz) {
if (urlField == null) {
try {
Field[] fds = clazz.getDeclaredFields();
diff --git a/platform/o.n.bootstrap/src/org/netbeans/Util.java b/platform/o.n.bootstrap/src/org/netbeans/Util.java
index 46845fe..5d40bbd 100644
--- a/platform/o.n.bootstrap/src/org/netbeans/Util.java
+++ b/platform/o.n.bootstrap/src/org/netbeans/Util.java
@@ -454,9 +454,8 @@
/** Fire changes to all result listeners. */
public void changed() {
synchronized (results) {
- Iterator it = results.iterator();
- while (it.hasNext()) {
- ((ModuleResult)it.next()).changed();
+ for (ModuleResult moduleResult : results) {
+ moduleResult.changed();
}
}
}
diff --git a/platform/o.n.bootstrap/test/unit/src/org/fakepkg/FakeHandler.java b/platform/o.n.bootstrap/test/unit/src/org/fakepkg/FakeHandler.java
index d7df692..15dbcd6 100644
--- a/platform/o.n.bootstrap/test/unit/src/org/fakepkg/FakeHandler.java
+++ b/platform/o.n.bootstrap/test/unit/src/org/fakepkg/FakeHandler.java
@@ -30,7 +30,7 @@
@org.openide.util.lookup.ServiceProvider(service=org.netbeans.CLIHandler.class)
public class FakeHandler extends CLIHandler {
public static Runnable toRun;
- public static Map chained;
+ public static Map<CLIHandler.Args, Integer> chained;
/** Creates a new instance of FakeHandler */
public FakeHandler() {
@@ -46,7 +46,7 @@
protected int cli(CLIHandler.Args args) {
if (chained != null) {
- Integer i = (Integer)chained.get(args);
+ Integer i = chained.get(args);
return i.intValue();
}
return 0;
diff --git a/platform/o.n.bootstrap/test/unit/src/org/netbeans/CountingSecurityManager.java b/platform/o.n.bootstrap/test/unit/src/org/netbeans/CountingSecurityManager.java
index 96bc9af..d29eb16 100644
--- a/platform/o.n.bootstrap/test/unit/src/org/netbeans/CountingSecurityManager.java
+++ b/platform/o.n.bootstrap/test/unit/src/org/netbeans/CountingSecurityManager.java
@@ -23,7 +23,7 @@
import java.io.PrintWriter;
import java.io.StringWriter;
import java.security.Permission;
-import junit.framework.Assert;
+import org.junit.Assert;
/**
*
diff --git a/platform/o.n.bootstrap/test/unit/src/org/netbeans/ModuleFactoryAlienTest.java b/platform/o.n.bootstrap/test/unit/src/org/netbeans/ModuleFactoryAlienTest.java
index 7326fcc..b40ad18 100644
--- a/platform/o.n.bootstrap/test/unit/src/org/netbeans/ModuleFactoryAlienTest.java
+++ b/platform/o.n.bootstrap/test/unit/src/org/netbeans/ModuleFactoryAlienTest.java
@@ -349,8 +349,8 @@
}
@Override
- protected synchronized Class loadClass(String name, boolean resolve) throws ClassNotFoundException {
- Class c = findLoadedClass(name);
+ protected synchronized Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
+ Class<?> c = findLoadedClass(name);
if (c != null) {
return c;
}
diff --git a/platform/o.n.bootstrap/test/unit/src/org/netbeans/ModuleFactoryTest.java b/platform/o.n.bootstrap/test/unit/src/org/netbeans/ModuleFactoryTest.java
index fa5cdc9..c42fc82 100644
--- a/platform/o.n.bootstrap/test/unit/src/org/netbeans/ModuleFactoryTest.java
+++ b/platform/o.n.bootstrap/test/unit/src/org/netbeans/ModuleFactoryTest.java
@@ -191,7 +191,7 @@
public void reload() throws IOException {
}
@Override
- protected void classLoaderUp(Set parents) throws IOException {
+ protected void classLoaderUp(Set<Module> parents) throws IOException {
classloader = new JarClassLoader(Collections.<File>emptyList(), new ClassLoader[] {new NoOpClassLoader()});
}
@Override
@@ -220,7 +220,7 @@
NoOpClassLoader() {
super(ClassLoader.getSystemClassLoader());
}
- protected @Override Class loadClass(String name, boolean resolve) throws ClassNotFoundException {
+ protected @Override Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
if ("java.lang.String".equals(name)) {
throw new ClassNotFoundException("NoOpClassLoader cannot load " + name);
}
diff --git a/platform/o.n.bootstrap/test/unit/src/org/netbeans/ModuleManagerTest.java b/platform/o.n.bootstrap/test/unit/src/org/netbeans/ModuleManagerTest.java
index 343edfa..42b60ef 100644
--- a/platform/o.n.bootstrap/test/unit/src/org/netbeans/ModuleManagerTest.java
+++ b/platform/o.n.bootstrap/test/unit/src/org/netbeans/ModuleManagerTest.java
@@ -206,7 +206,7 @@
}
assertEquals(Collections.EMPTY_SET, m1.getProblems());
assertEquals(Collections.EMPTY_SET, m2.getProblems());
- List toEnable = mgr.simulateEnable(Collections.singleton(m2));
+ List<Module> toEnable = mgr.simulateEnable(Collections.singleton(m2));
assertEquals("correct result of simulateEnable", Arrays.asList(m1, m2), toEnable);
mgr.enable(Collections.singleton(m2));
assertEquals(Arrays.asList(
@@ -259,7 +259,7 @@
}
assertEquals(Collections.EMPTY_SET, m1.getProblems());
assertEquals(Collections.EMPTY_SET, m2.getProblems());
- List toEnable = mgr.simulateEnable(Collections.singleton(m1));
+ List<Module> toEnable = mgr.simulateEnable(Collections.singleton(m1));
assertEquals("correct result of simulateEnable", Arrays.asList(m1, m2), toEnable);
mgr.enable(Collections.singleton(m1));
assertEquals(Arrays.asList(
@@ -304,7 +304,7 @@
Module m1 = mgr.create(new File(jars, "simple-module.jar"), null, false, true, false);
Module m2 = mgr.create(new File(jars, "depends-on-simple-module.jar"), null, false, false, false);
Module m3 = mgr.create(new File(jars, "dep-on-dep-on-simple.jar"), null, false, false, true);
- List toEnable = mgr.simulateEnable(Collections.singleton(m2));
+ List<Module> toEnable = mgr.simulateEnable(Collections.singleton(m2));
assertEquals("correct result of simulateEnable", Arrays.asList(m1, m2, m3), toEnable);
mgr.enable(Collections.singleton(m2));
assertEquals(Arrays.asList(
@@ -360,13 +360,13 @@
assertTrue(m1.isEnabled());
assertFalse(m2.isEnabled());
assertTrue(m3.isEnabled());
- List toEnable = mgr.simulateEnable(Collections.singleton(m2));
+ List<Module> toEnable = mgr.simulateEnable(Collections.singleton(m2));
assertEquals("correct result of simulateEnable", Collections.singletonList(m2), toEnable);
mgr.enable(Collections.singleton(m2));
assertTrue(m1.isEnabled());
assertTrue(m2.isEnabled());
assertTrue(m3.isEnabled());
- List toDisable = mgr.simulateDisable(Collections.singleton(m2));
+ List<Module> toDisable = mgr.simulateDisable(Collections.singleton(m2));
assertEquals("correct result of simulateDisable", Collections.singletonList(m2), toDisable);
mgr.disable(Collections.singleton(m2));
assertTrue(m1.isEnabled());
@@ -629,7 +629,7 @@
// Make sure that classloading is OK:
Module m = mgr.create(new File(jars, "depends-on-lib-undecl.jar"), null, false, false, false);
mgr.enable(m);
- Class c = m.getClassLoader().loadClass("org.dol.User");
+ Class<?> c = m.getClassLoader().loadClass("org.dol.User");
Object o = c.newInstance();
Field f = c.getField("val");
assertEquals(42, f.getInt(o));
@@ -862,7 +862,7 @@
try {
Module m = mgr.create(new File(jars, "patchable.jar"), null, false, false, false);
mgr.enable(m);
- Class c = m.getClassLoader().loadClass("pkg.subpkg.A");
+ Class<?> c = m.getClassLoader().loadClass("pkg.subpkg.A");
Field f = c.getField("val");
Object o = c.newInstance();
assertEquals(25, f.getInt(o));
@@ -913,7 +913,7 @@
m2,
Arrays.asList(m1, m2)
), installer.args);
- Class testclazz = Class.forName("org.prov_foo.Clazz", true, m1.getClassLoader());
+ Class<?> testclazz = Class.forName("org.prov_foo.Clazz", true, m1.getClassLoader());
try {
Class.forName("org.prov_foo.Clazz", true, m2.getClassLoader());
fail("Should not be able to access classes due to prov-req deps only");
@@ -1161,7 +1161,7 @@
m1,
Arrays.asList(m2, m1)
), installer.args);
- Class testclazz = Class.forName("org.prov_foo.Clazz", true, m1.getClassLoader());
+ Class<?> testclazz = Class.forName("org.prov_foo.Clazz", true, m1.getClassLoader());
try {
Class.forName("org.prov_foo.Clazz", true, m2.getClassLoader());
fail("Should not be able to access classes due to prov-req deps only");
@@ -1227,7 +1227,7 @@
// m3 is eager module, which depends on m2
Module m3 = mgr.create(new File(jars, "dep-on-needs_foo-simple.jar"), null, false, false, true);
- mgr.enable(Collections.EMPTY_SET);
+ mgr.enable(Collections.emptySet());
// since m1 is disabled, eager module m3 should be still disabled
assertFalse("Incorrectly enabled m1",m1.isEnabled());
assertFalse("Incorrectly enabled m2",m2.isEnabled());
@@ -1326,7 +1326,7 @@
m1,
Arrays.asList(m2, m1)
), installer.args);
- Class testclazz = Class.forName("org.prov_foo.Clazz", true, m1.getClassLoader());
+ Class<?> testclazz = Class.forName("org.prov_foo.Clazz", true, m1.getClassLoader());
try {
Class.forName("org.prov_foo.Clazz", true, m2.getClassLoader());
fail("Should not be able to access classes due to prov-req deps only");
@@ -1475,7 +1475,7 @@
m3 = mgr.create(copyJar(m2.getJarFile(), manifest), null, false, true, false);
}
- Set allThreeModules = new HashSet<Module>(Arrays.asList(m1, m3, m2));
+ Set<Module> allThreeModules = new HashSet<>(Arrays.asList(m1, m3, m2));
toEnable = mgr.simulateEnable(new HashSet<Module>(m2List));
assertEquals("all 3 need to be enabled", allThreeModules, new HashSet<Module>(toEnable));
@@ -1855,7 +1855,7 @@
try {
Module m = mgr.create(jar, null, false, false, false);
mgr.enable(m);
- Class c = m.getClassLoader().loadClass("org.foo.Something");
+ Class<?> c = m.getClassLoader().loadClass("org.foo.Something");
URL u = m.getClassLoader().getResource("org/foo/Something.class");
URLConnection uc = u.openConnection();
assertNotNull("connetion", uc);
@@ -1864,9 +1864,9 @@
mgr.disable(m);
mgr.delete(m);
- WeakReference<Class> refC = new WeakReference<Class>(c);
- WeakReference<URL> refU = new WeakReference<URL>(u);
- WeakReference<URLConnection> refUC = new WeakReference<URLConnection>(uc);
+ WeakReference<Class<?>> refC = new WeakReference<>(c);
+ WeakReference<URL> refU = new WeakReference<>(u);
+ WeakReference<URLConnection> refUC = new WeakReference<>(uc);
c = null;
u = null;
@@ -2238,31 +2238,31 @@
Module m1 = mgr.create(new File(jars, "simple-module.jar"), null, false, false, false);
Module m2 = mgr.create(new File(jars, "depends-on-simple-module.jar"), null, false, false, false);
Module m3 = mgr.create(new File(jars, "dep-on-dep-on-simple.jar"), null, false, false, false);
- Set<Module> m1m2 = new HashSet<Module>(Arrays.asList(m1, m2));
- Set<Module> m2m3 = new HashSet<Module>(Arrays.asList(m2, m3));
- assertEquals(Collections.EMPTY_SET, mgr.getModuleInterdependencies(m1, false, false));
- assertEquals(Collections.EMPTY_SET, mgr.getModuleInterdependencies(m1, false, true));
- assertEquals(Collections.singleton(m2), mgr.getModuleInterdependencies(m1, true, false));
- assertEquals(m2m3, mgr.getModuleInterdependencies(m1, true, true));
- assertEquals(Collections.singleton(m1), mgr.getModuleInterdependencies(m2, false, false));
- assertEquals(Collections.singleton(m1), mgr.getModuleInterdependencies(m2, false, true));
- assertEquals(Collections.singleton(m3), mgr.getModuleInterdependencies(m2, true, false));
- assertEquals(Collections.singleton(m3), mgr.getModuleInterdependencies(m2, true, true));
- assertEquals(Collections.singleton(m2), mgr.getModuleInterdependencies(m3, false, false));
- assertEquals(m1m2, mgr.getModuleInterdependencies(m3, false, true));
- assertEquals(Collections.EMPTY_SET, mgr.getModuleInterdependencies(m3, true, false));
- assertEquals(Collections.EMPTY_SET, mgr.getModuleInterdependencies(m3, true, true));
+ Set<Module> m1m2 = new HashSet<>(Arrays.asList(m1, m2));
+ Set<Module> m2m3 = new HashSet<>(Arrays.asList(m2, m3));
+ assertEquals(Collections.EMPTY_SET, mgr.getModuleInterdependencies(m1, false, false, true));
+ assertEquals(Collections.EMPTY_SET, mgr.getModuleInterdependencies(m1, false, true, true));
+ assertEquals(Collections.singleton(m2), mgr.getModuleInterdependencies(m1, true, false, true));
+ assertEquals(m2m3, mgr.getModuleInterdependencies(m1, true, true, true));
+ assertEquals(Collections.singleton(m1), mgr.getModuleInterdependencies(m2, false, false, true));
+ assertEquals(Collections.singleton(m1), mgr.getModuleInterdependencies(m2, false, true, true));
+ assertEquals(Collections.singleton(m3), mgr.getModuleInterdependencies(m2, true, false, true));
+ assertEquals(Collections.singleton(m3), mgr.getModuleInterdependencies(m2, true, true, true));
+ assertEquals(Collections.singleton(m2), mgr.getModuleInterdependencies(m3, false, false, true));
+ assertEquals(m1m2, mgr.getModuleInterdependencies(m3, false, true, true));
+ assertEquals(Collections.EMPTY_SET, mgr.getModuleInterdependencies(m3, true, false, true));
+ assertEquals(Collections.EMPTY_SET, mgr.getModuleInterdependencies(m3, true, true, true));
m1 = mgr.create(new File(jars, "prov-foo.jar"), null, false, false, false);
m2 = mgr.create(new File(jars, "prov-foo-bar.jar"), null, false, false, false);
m3 = mgr.create(new File(jars, "req-foo.jar"), null, false, false, false);
Module m4 = mgr.create(new File(jars, "prov-baz.jar"), null, false, false, false);
Module m5 = mgr.create(new File(jars, "req-foo-baz.jar"), null, false, false, false);
- m1m2 = new HashSet<Module>(Arrays.asList(m1, m2));
- assertEquals(m1m2, mgr.getModuleInterdependencies(m3, false, true));
- Set<Module> m1m2m4 = new HashSet<Module>(Arrays.asList(m1, m2, m4));
- assertEquals(m1m2m4, mgr.getModuleInterdependencies(m5, false, true));
- Set<Module> m3m5 = new HashSet<Module>(Arrays.asList(m3, m5));
- assertEquals(m3m5, mgr.getModuleInterdependencies(m1, true, true));
+ m1m2 = new HashSet<>(Arrays.asList(m1, m2));
+ assertEquals(m1m2, mgr.getModuleInterdependencies(m3, false, true, true));
+ Set<Module> m1m2m4 = new HashSet<>(Arrays.asList(m1, m2, m4));
+ assertEquals(m1m2m4, mgr.getModuleInterdependencies(m5, false, true, true));
+ Set<Module> m3m5 = new HashSet<>(Arrays.asList(m3, m5));
+ assertEquals(m3m5, mgr.getModuleInterdependencies(m1, true, true, true));
// XXX could do more...
} finally {
mgr.mutexPrivileged().exitWriteAccess();
@@ -2295,20 +2295,20 @@
Module m1 = mgr.create(f1, null, false, false, false);
Module m2 = mgr.create(f2, null, false, false, false);
Module m3 = mgr.create(f3, null, false, false, false);
- Set<Module> m1m2 = new HashSet<Module>(Arrays.asList(m1, m2));
- Set<Module> m2m3 = new HashSet<Module>(Arrays.asList(m2, m3));
- assertEquals(Collections.EMPTY_SET, mgr.getModuleInterdependencies(m1, false, false));
- assertEquals(Collections.EMPTY_SET, mgr.getModuleInterdependencies(m1, false, true));
- assertEquals(Collections.singleton(m2), mgr.getModuleInterdependencies(m1, true, false));
- assertEquals(m2m3, mgr.getModuleInterdependencies(m1, true, true));
- assertEquals(Collections.singleton(m1), mgr.getModuleInterdependencies(m2, false, false));
- assertEquals(Collections.singleton(m1), mgr.getModuleInterdependencies(m2, false, true));
- assertEquals(Collections.singleton(m3), mgr.getModuleInterdependencies(m2, true, false));
- assertEquals(Collections.singleton(m3), mgr.getModuleInterdependencies(m2, true, true));
- assertEquals(Collections.singleton(m2), mgr.getModuleInterdependencies(m3, false, false));
- assertEquals(m1m2, mgr.getModuleInterdependencies(m3, false, true));
- assertEquals(Collections.EMPTY_SET, mgr.getModuleInterdependencies(m3, true, false));
- assertEquals(Collections.EMPTY_SET, mgr.getModuleInterdependencies(m3, true, true));
+ Set<Module> m1m2 = new HashSet<>(Arrays.asList(m1, m2));
+ Set<Module> m2m3 = new HashSet<>(Arrays.asList(m2, m3));
+ assertEquals(Collections.EMPTY_SET, mgr.getModuleInterdependencies(m1, false, false, true));
+ assertEquals(Collections.EMPTY_SET, mgr.getModuleInterdependencies(m1, false, true, true));
+ assertEquals(Collections.singleton(m2), mgr.getModuleInterdependencies(m1, true, false, true));
+ assertEquals(m2m3, mgr.getModuleInterdependencies(m1, true, true, true));
+ assertEquals(Collections.singleton(m1), mgr.getModuleInterdependencies(m2, false, false, true));
+ assertEquals(Collections.singleton(m1), mgr.getModuleInterdependencies(m2, false, true, true));
+ assertEquals(Collections.singleton(m3), mgr.getModuleInterdependencies(m2, true, false, true));
+ assertEquals(Collections.singleton(m3), mgr.getModuleInterdependencies(m2, true, true, true));
+ assertEquals(Collections.singleton(m2), mgr.getModuleInterdependencies(m3, false, false, true));
+ assertEquals(m1m2, mgr.getModuleInterdependencies(m3, false, true, true));
+ assertEquals(Collections.EMPTY_SET, mgr.getModuleInterdependencies(m3, true, false, true));
+ assertEquals(Collections.EMPTY_SET, mgr.getModuleInterdependencies(m3, true, true, true));
} finally {
mgr.mutexPrivileged().exitWriteAccess();
}
@@ -2342,20 +2342,20 @@
Module m1 = mgr.create(f1, null, false, false, false);
Module m2 = mgr.create(f2, null, false, false, false);
Module m3 = mgr.create(f3, null, false, false, false);
- Set<Module> m1m2 = new HashSet<Module>(Arrays.asList(m1, m2));
- Set<Module> m2m3 = new HashSet<Module>(Arrays.asList(m2, m3));
- assertEquals(Collections.EMPTY_SET, mgr.getModuleInterdependencies(m1, false, false));
- assertEquals(Collections.EMPTY_SET, mgr.getModuleInterdependencies(m1, false, true));
- assertEquals(Collections.singleton(m2), mgr.getModuleInterdependencies(m1, true, false));
- assertEquals(m2m3, mgr.getModuleInterdependencies(m1, true, true));
- assertEquals(Collections.singleton(m1), mgr.getModuleInterdependencies(m2, false, false));
- assertEquals(Collections.singleton(m1), mgr.getModuleInterdependencies(m2, false, true));
- assertEquals(Collections.singleton(m3), mgr.getModuleInterdependencies(m2, true, false));
- assertEquals(Collections.singleton(m3), mgr.getModuleInterdependencies(m2, true, true));
- assertEquals(Collections.singleton(m2), mgr.getModuleInterdependencies(m3, false, false));
- assertEquals(m1m2, mgr.getModuleInterdependencies(m3, false, true));
- assertEquals(Collections.EMPTY_SET, mgr.getModuleInterdependencies(m3, true, false));
- assertEquals(Collections.EMPTY_SET, mgr.getModuleInterdependencies(m3, true, true));
+ Set<Module> m1m2 = new HashSet<>(Arrays.asList(m1, m2));
+ Set<Module> m2m3 = new HashSet<>(Arrays.asList(m2, m3));
+ assertEquals(Collections.EMPTY_SET, mgr.getModuleInterdependencies(m1, false, false, true));
+ assertEquals(Collections.EMPTY_SET, mgr.getModuleInterdependencies(m1, false, true, true));
+ assertEquals(Collections.singleton(m2), mgr.getModuleInterdependencies(m1, true, false, true));
+ assertEquals(m2m3, mgr.getModuleInterdependencies(m1, true, true, true));
+ assertEquals(Collections.singleton(m1), mgr.getModuleInterdependencies(m2, false, false, true));
+ assertEquals(Collections.singleton(m1), mgr.getModuleInterdependencies(m2, false, true, true));
+ assertEquals(Collections.singleton(m3), mgr.getModuleInterdependencies(m2, true, false, true));
+ assertEquals(Collections.singleton(m3), mgr.getModuleInterdependencies(m2, true, true, true));
+ assertEquals(Collections.singleton(m2), mgr.getModuleInterdependencies(m3, false, false, true));
+ assertEquals(m1m2, mgr.getModuleInterdependencies(m3, false, true, true));
+ assertEquals(Collections.EMPTY_SET, mgr.getModuleInterdependencies(m3, true, false, true));
+ assertEquals(Collections.EMPTY_SET, mgr.getModuleInterdependencies(m3, true, true, true));
} finally {
mgr.mutexPrivileged().exitWriteAccess();
}
@@ -2378,18 +2378,18 @@
jar = new File(dir, "client.jar");
TestFileUtils.writeZipFile(jar, "META-INF/MANIFEST.MF:OpenIDE-Module: client\nOpenIDE-Module-Module-Dependencies: api\n\n");
Module client = mgr.create(jar, null, false, false, false);
- assertEquals(Collections.singleton(api), mgr.getModuleInterdependencies(impl, false, false));
- assertEquals(Collections.singleton(api), mgr.getModuleInterdependencies(impl, false, true));
- assertEquals(Collections.singleton(api), mgr.getModuleInterdependencies(impl, true, false));
- assertEquals(new HashSet<Module>(Arrays.asList(api, client)), mgr.getModuleInterdependencies(impl, true, true));
- assertEquals(Collections.singleton(api), mgr.getModuleInterdependencies(client, false, false));
- assertEquals(new HashSet<Module>(Arrays.asList(api, impl)), mgr.getModuleInterdependencies(client, false, true));
- assertEquals(Collections.emptySet(), mgr.getModuleInterdependencies(client, true, false));
- assertEquals(Collections.emptySet(), mgr.getModuleInterdependencies(client, true, true));
- assertEquals(Collections.singleton(impl), mgr.getModuleInterdependencies(api, false, false));
- assertEquals(Collections.singleton(impl), mgr.getModuleInterdependencies(api, false, true));
- assertEquals(new HashSet<Module>(Arrays.asList(impl, client)), mgr.getModuleInterdependencies(api, true, false));
- assertEquals(new HashSet<Module>(Arrays.asList(impl, client)), mgr.getModuleInterdependencies(api, true, true));
+ assertEquals(Collections.singleton(api), mgr.getModuleInterdependencies(impl, false, false, true));
+ assertEquals(Collections.singleton(api), mgr.getModuleInterdependencies(impl, false, true, true));
+ assertEquals(Collections.singleton(api), mgr.getModuleInterdependencies(impl, true, false, true));
+ assertEquals(new HashSet<Module>(Arrays.asList(api, client)), mgr.getModuleInterdependencies(impl, true, true, true));
+ assertEquals(Collections.singleton(api), mgr.getModuleInterdependencies(client, false, false, true));
+ assertEquals(new HashSet<Module>(Arrays.asList(api, impl)), mgr.getModuleInterdependencies(client, false, true, true));
+ assertEquals(Collections.emptySet(), mgr.getModuleInterdependencies(client, true, false, true));
+ assertEquals(Collections.emptySet(), mgr.getModuleInterdependencies(client, true, true, true));
+ assertEquals(Collections.singleton(impl), mgr.getModuleInterdependencies(api, false, false, true));
+ assertEquals(Collections.singleton(impl), mgr.getModuleInterdependencies(api, false, true, true));
+ assertEquals(new HashSet<Module>(Arrays.asList(impl, client)), mgr.getModuleInterdependencies(api, true, false, true));
+ assertEquals(new HashSet<Module>(Arrays.asList(impl, client)), mgr.getModuleInterdependencies(api, true, true, true));
} finally {
mgr.mutexPrivileged().exitWriteAccess();
}
@@ -2408,15 +2408,15 @@
jar = new File(dir, "b.jar");
TestFileUtils.writeZipFile(jar, "META-INF/MANIFEST.MF:OpenIDE-Module: b\nOpenIDE-Module-Needs: T2\nOpenIDE-Module-Provides: T1\n\n");
Module b = mgr.create(jar, null, false, false, false);
- assertEquals(Collections.singleton(a), mgr.getModuleInterdependencies(b, false, false));
- assertEquals(Collections.singleton(a), mgr.getModuleInterdependencies(b, false, true));
- assertEquals(Collections.singleton(a), mgr.getModuleInterdependencies(b, true, false));
- assertEquals(Collections.singleton(a), mgr.getModuleInterdependencies(b, true, true));
- assertEquals(Collections.singleton(b), mgr.getModuleInterdependencies(a, false, false));
- assertEquals(Collections.singleton(b), mgr.getModuleInterdependencies(a, false, true));
- assertEquals(Collections.singleton(b), mgr.getModuleInterdependencies(a, true, false));
- assertEquals(Collections.singleton(b), mgr.getModuleInterdependencies(a, true, true));
- Set<Module> both = new HashSet<Module>(Arrays.asList(a, b));
+ assertEquals(Collections.singleton(a), mgr.getModuleInterdependencies(b, false, false, true));
+ assertEquals(Collections.singleton(a), mgr.getModuleInterdependencies(b, false, true, true));
+ assertEquals(Collections.singleton(a), mgr.getModuleInterdependencies(b, true, false, true));
+ assertEquals(Collections.singleton(a), mgr.getModuleInterdependencies(b, true, true, true));
+ assertEquals(Collections.singleton(b), mgr.getModuleInterdependencies(a, false, false, true));
+ assertEquals(Collections.singleton(b), mgr.getModuleInterdependencies(a, false, true, true));
+ assertEquals(Collections.singleton(b), mgr.getModuleInterdependencies(a, true, false, true));
+ assertEquals(Collections.singleton(b), mgr.getModuleInterdependencies(a, true, true, true));
+ Set<Module> both = new HashSet<>(Arrays.asList(a, b));
assertEquals(both, new HashSet<Module>(mgr.simulateEnable(Collections.singleton(a))));
assertEquals(both, new HashSet<Module>(mgr.simulateEnable(Collections.singleton(b))));
mgr.enable(both);
@@ -2432,15 +2432,15 @@
jar = new File(dir, "b.jar");
TestFileUtils.writeZipFile(jar, "META-INF/MANIFEST.MF:OpenIDE-Module: b\nOpenIDE-Module-Needs: T2\nOpenIDE-Module-Provides: T1\n\n");
b = mgr.create(jar, null, false, false, false);
- assertEquals(Collections.singleton(a), mgr.getModuleInterdependencies(b, false, false));
- assertEquals(Collections.singleton(a), mgr.getModuleInterdependencies(b, false, true));
- assertEquals(Collections.singleton(a), mgr.getModuleInterdependencies(b, true, false));
- assertEquals(Collections.singleton(a), mgr.getModuleInterdependencies(b, true, true));
- assertEquals(Collections.singleton(b), mgr.getModuleInterdependencies(a, false, false));
- assertEquals(Collections.singleton(b), mgr.getModuleInterdependencies(a, false, true));
- assertEquals(Collections.singleton(b), mgr.getModuleInterdependencies(a, true, false));
- assertEquals(Collections.singleton(b), mgr.getModuleInterdependencies(a, true, true));
- both = new HashSet<Module>(Arrays.asList(a, b));
+ assertEquals(Collections.singleton(a), mgr.getModuleInterdependencies(b, false, false, true));
+ assertEquals(Collections.singleton(a), mgr.getModuleInterdependencies(b, false, true, true));
+ assertEquals(Collections.singleton(a), mgr.getModuleInterdependencies(b, true, false, true));
+ assertEquals(Collections.singleton(a), mgr.getModuleInterdependencies(b, true, true, true));
+ assertEquals(Collections.singleton(b), mgr.getModuleInterdependencies(a, false, false, true));
+ assertEquals(Collections.singleton(b), mgr.getModuleInterdependencies(a, false, true, true));
+ assertEquals(Collections.singleton(b), mgr.getModuleInterdependencies(a, true, false, true));
+ assertEquals(Collections.singleton(b), mgr.getModuleInterdependencies(a, true, true, true));
+ both = new HashSet<>(Arrays.asList(a, b));
assertEquals(both, new HashSet<Module>(mgr.simulateEnable(Collections.singleton(a))));
assertEquals(both, new HashSet<Module>(mgr.simulateEnable(Collections.singleton(b))));
mgr.enable(both);
@@ -2694,9 +2694,9 @@
mgr.enable(mod1);
Module mod2 = mgr.create(mod2JAR, null, false, false, false);
mgr.enable(mod2);
- Class c1 = mod1.getClassLoader().loadClass("pkg.C1");
- Class c2 = mod1.getClassLoader().loadClass("pkg.C2");
- Class c3 = mod2.getClassLoader().loadClass("pkg.C3");
+ Class<?> c1 = mod1.getClassLoader().loadClass("pkg.C1");
+ Class<?> c2 = mod1.getClassLoader().loadClass("pkg.C2");
+ Class<?> c3 = mod2.getClassLoader().loadClass("pkg.C3");
assertTrue(mod1.owns(c1));
assertTrue(mod1.owns(c2));
assertFalse(mod1.owns(c3));
@@ -2721,10 +2721,10 @@
assertEquals(l, mod1.getClassLoader());
Module mod2 = mgr.createFixed(loadManifest(mod2JAR), null, l);
mgr.enable(mod2);
- Class c1 = l.loadClass("pkg.C1");
+ Class<?> c1 = l.loadClass("pkg.C1");
assertEquals(l, c1.getClassLoader());
- Class c2 = l.loadClass("pkg.C2");
- Class c3 = l.loadClass("pkg.C3");
+ Class<?> c2 = l.loadClass("pkg.C2");
+ Class<?> c3 = l.loadClass("pkg.C3");
assertTrue(mod1.owns(c1));
assertTrue(mod1.owns(c2));
assertFalse(mod1.owns(c3));
@@ -2808,7 +2808,7 @@
// m1 autoload, m2 normal, m3 eager
Module m1 = mgr.create(new File(jars, "host-module.jar"), null, false, false, false);
Module m2 = mgr.create(new File(jars, "fragment-module.jar"), null, false, false, false);
- List toEnable = mgr.simulateEnable(Collections.singleton(m2));
+ List<Module> toEnable = mgr.simulateEnable(Collections.singleton(m2));
assertTrue("Host will be enabled", toEnable.contains(m1));
assertTrue("Known fragment must be merged in", toEnable.contains(m2));
@@ -2824,7 +2824,7 @@
// m1 autoload, m2 normal, m3 eager
Module m1 = mgr.create(new File(jars, "host-module.jar"), null, false, false, false);
Module m2 = mgr.create(new File(jars, "fragment-module.jar"), null, false, false, false);
- List toEnable = mgr.simulateEnable(Collections.singleton(m2));
+ List<Module> toEnable = mgr.simulateEnable(Collections.singleton(m2));
assertTrue("Host will be enabled", toEnable.contains(m1));
assertTrue("Known fragment must be merged in", toEnable.contains(m2));
diff --git a/platform/o.n.bootstrap/test/unit/src/org/netbeans/PatchByteCodeTest.java b/platform/o.n.bootstrap/test/unit/src/org/netbeans/PatchByteCodeTest.java
index 59937fc..ad7be14 100644
--- a/platform/o.n.bootstrap/test/unit/src/org/netbeans/PatchByteCodeTest.java
+++ b/platform/o.n.bootstrap/test/unit/src/org/netbeans/PatchByteCodeTest.java
@@ -41,9 +41,9 @@
public static class C {
static final long x = 123L; // test CONSTANT_Long, tricky!
- private C(boolean _) {}
+ private C(boolean doNotCare) {}
@PatchedPublic
- private C(int _) {}
+ private C(int doNotCare) {}
private void m1() {}
@PatchedPublic
private void m2() {}
@@ -124,7 +124,7 @@
} catch (IOException x) {
throw new ClassNotFoundException(name, x);
}
- Class c = defineClass(name, data, 0, data.length);
+ Class<?> c = defineClass(name, data, 0, data.length);
if (resolve) {
resolveClass(c);
}
diff --git a/platform/o.n.bootstrap/test/unit/src/org/netbeans/ProxyClassLoaderNB11PackageAnnotationsTest.java b/platform/o.n.bootstrap/test/unit/src/org/netbeans/ProxyClassLoaderNB11PackageAnnotationsTest.java
index c4d53a2..24a43c9 100644
--- a/platform/o.n.bootstrap/test/unit/src/org/netbeans/ProxyClassLoaderNB11PackageAnnotationsTest.java
+++ b/platform/o.n.bootstrap/test/unit/src/org/netbeans/ProxyClassLoaderNB11PackageAnnotationsTest.java
@@ -49,7 +49,7 @@
}
@Override
- protected Class doLoadClass(String pkg, String name) {
+ protected Class<?> doLoadClass(String pkg, String name) {
if (name.startsWith(TEST_PACKAGE)) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
InputStream is = PackageClassLoader.class.getClassLoader().getResourceAsStream(name.replace('.', '/') + ".class");
@@ -80,7 +80,7 @@
}
final ProxyClassLoader cl = new PackageClassLoader();
- final Class<? extends Annotation> annotClz = (Class<? extends Annotation>) cl.loadClass(TEST_PACKAGE + ".NB11PackageTestAnnotation");
+ final Class<? extends Annotation> annotClz = cl.loadClass(TEST_PACKAGE + ".NB11PackageTestAnnotation").asSubclass(Annotation.class);
final Package pkg = annotClz.getPackage();
final Object annot = pkg.getAnnotation(annotClz);
assertTrue("Annotation not found", annot != null);
diff --git a/platform/o.n.bootstrap/test/unit/src/org/netbeans/ProxyClassLoaderTest.java b/platform/o.n.bootstrap/test/unit/src/org/netbeans/ProxyClassLoaderTest.java
index 8912dad..a488be4 100644
--- a/platform/o.n.bootstrap/test/unit/src/org/netbeans/ProxyClassLoaderTest.java
+++ b/platform/o.n.bootstrap/test/unit/src/org/netbeans/ProxyClassLoaderTest.java
@@ -42,16 +42,16 @@
public void testAmbiguousDelegation() throws Exception {
class CL extends ProxyClassLoader {
- final Class[] owned;
+ final Class<?>[] owned;
final String name;
- CL(ClassLoader[] parents, String _name, Class... _owned) {
+ CL(ClassLoader[] parents, String _name, Class<?>... _owned) {
super(parents, false);
addCoveredPackages(Collections.singleton("org.netbeans"));
name = _name;
owned = _owned;
}
- protected @Override Class doLoadClass(String pkg, String name) {
- for (Class c : owned) {
+ protected @Override Class<?> doLoadClass(String pkg, String name) {
+ for (Class<?> c : owned) {
if (name.equals(c.getName())) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
InputStream is = CL.class.getClassLoader().getResourceAsStream(name.replace('.', '/') + ".class");
@@ -86,7 +86,7 @@
assertEquals(l3, l3.loadClass(B.class.getName()).getClassLoader());
assertEquals(l1, l3.loadClass(B.class.getName()).getMethod("a").invoke(null).getClass().getClassLoader());
try {
- Class c = l4.loadClass(A.class.getName());
+ Class<?> c = l4.loadClass(A.class.getName());
fail("arbitrarily loaded A from " + c.getClassLoader());
} catch (ClassNotFoundException x) {/* OK */}
try {
@@ -206,8 +206,8 @@
}
@Override
- protected synchronized Class loadClass(String name, boolean resolve) throws ClassNotFoundException {
- Class c = findLoadedClass(name);
+ protected synchronized Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
+ Class<?> c = findLoadedClass(name);
if (c != null) {
return c;
}
diff --git a/platform/o.n.bootstrap/test/unit/src/org/netbeans/ProxyClassPackagesTest.java b/platform/o.n.bootstrap/test/unit/src/org/netbeans/ProxyClassPackagesTest.java
index 44054fb..ee231c5 100644
--- a/platform/o.n.bootstrap/test/unit/src/org/netbeans/ProxyClassPackagesTest.java
+++ b/platform/o.n.bootstrap/test/unit/src/org/netbeans/ProxyClassPackagesTest.java
@@ -25,9 +25,6 @@
import java.util.Collections;
import java.util.Enumeration;
import java.util.Set;
-import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.assertFalse;
-import static junit.framework.Assert.assertTrue;
import org.netbeans.junit.NbTestCase;
import org.openide.util.test.TestFileUtils;
diff --git a/platform/o.n.bootstrap/test/unit/src/org/netbeans/ProxyURLStreamHandlerFactoryTest.java b/platform/o.n.bootstrap/test/unit/src/org/netbeans/ProxyURLStreamHandlerFactoryTest.java
index a4bcade..5e36a6b 100644
--- a/platform/o.n.bootstrap/test/unit/src/org/netbeans/ProxyURLStreamHandlerFactoryTest.java
+++ b/platform/o.n.bootstrap/test/unit/src/org/netbeans/ProxyURLStreamHandlerFactoryTest.java
@@ -73,7 +73,7 @@
os.write(10);
os.close();
- URL u = new URL("jar:" + f.toURL() + "!/test.txt");
+ URL u = new URL("jar:" + f.toURI().toURL() + "!/test.txt");
DataInputStream is = new DataInputStream(u.openStream());
byte[] arr = new byte[100];
is.readFully(arr, 0, 1);
diff --git a/platform/o.n.bootstrap/test/unit/src/org/netbeans/SetupHid.java b/platform/o.n.bootstrap/test/unit/src/org/netbeans/SetupHid.java
index d748864..98ccca6 100644
--- a/platform/o.n.bootstrap/test/unit/src/org/netbeans/SetupHid.java
+++ b/platform/o.n.bootstrap/test/unit/src/org/netbeans/SetupHid.java
@@ -129,11 +129,9 @@
OutputStream os = new FileOutputStream(jar);
try {
JarOutputStream jos = new JarOutputStream(os, m);
- Iterator it = contents.entrySet().iterator();
- while (it.hasNext()) {
- Map.Entry entry = (Map.Entry) it.next();
- String path = (String) entry.getKey();
- byte[] data = ((String) entry.getValue()).getBytes("UTF-8");
+ for (Map.Entry<String, String> entry : contents.entrySet()) {
+ String path = entry.getKey();
+ byte[] data = entry.getValue().getBytes("UTF-8");
JarEntry je = new JarEntry(path);
je.setSize(data.length);
CRC32 crc = new CRC32();