Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d8e55dc

Browse filesBrowse files
authored
Use JDK7 and JDK8 Code Features in Platform mappings (#1565)
* Use Diamond Operator except for anonymous inner classes * Use try-with-resources * Use Multi-catch * Use constants for system properties
1 parent 9e5243f commit d8e55dc
Copy full SHA for d8e55dc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner

55 files changed

+164
-197
lines changed

‎contrib/platform/src/com/sun/jna/platform/EnumUtils.java

Copy file name to clipboardExpand all lines: contrib/platform/src/com/sun/jna/platform/EnumUtils.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public static <E extends Enum<E>> E fromInteger(int idx, Class<E> clazz)
8282
public static <T extends FlagEnum> Set<T> setFromInteger(int flags, Class<T> clazz)
8383
{
8484
T[] vals = clazz.getEnumConstants();
85-
Set<T> result = new HashSet<T>();
85+
Set<T> result = new HashSet<>();
8686

8787
for (T val : vals)
8888
{

‎contrib/platform/src/com/sun/jna/platform/FileMonitor.java

Copy file name to clipboardExpand all lines: contrib/platform/src/com/sun/jna/platform/FileMonitor.java
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ public String toString() {
7474
}
7575
}
7676

77-
private final Map<File, Integer> watched = new HashMap<File, Integer>();
78-
private List<FileListener> listeners = new ArrayList<FileListener>();
77+
private final Map<File, Integer> watched = new HashMap<>();
78+
private List<FileListener> listeners = new ArrayList<>();
7979

8080
protected abstract void watch(File file, int mask, boolean recursive) throws IOException ;
8181
protected abstract void unwatch(File file);
@@ -107,13 +107,13 @@ protected void notify(FileEvent e) {
107107
}
108108

109109
public synchronized void addFileListener(FileListener listener) {
110-
List<FileListener> list = new ArrayList<FileListener>(listeners);
110+
List<FileListener> list = new ArrayList<>(listeners);
111111
list.add(listener);
112112
listeners = list;
113113
}
114114

115115
public synchronized void removeFileListener(FileListener x) {
116-
List<FileListener> list = new ArrayList<FileListener>(listeners);
116+
List<FileListener> list = new ArrayList<>(listeners);
117117
list.remove(x);
118118
listeners = list;
119119
}

‎contrib/platform/src/com/sun/jna/platform/FileUtils.java

Copy file name to clipboardExpand all lines: contrib/platform/src/com/sun/jna/platform/FileUtils.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public void moveToTrash(File... files) throws IOException {
104104
if (!trash.exists()) {
105105
throw new IOException("No trash location found (define fileutils.trash to be the path to the trash)");
106106
}
107-
List<File> failed = new ArrayList<File>();
107+
List<File> failed = new ArrayList<>();
108108
for (int i=0;i < files.length;i++) {
109109
File src = files[i];
110110
File target = new File(trash, src.getName());

‎contrib/platform/src/com/sun/jna/platform/RasterRangesUtils.java

Copy file name to clipboardExpand all lines: contrib/platform/src/com/sun/jna/platform/RasterRangesUtils.java
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,11 @@ public static boolean outputOccupiedRanges(Raster raster, RangesOutput out) {
128128
* @return true if the output succeeded, false otherwise
129129
*/
130130
public static boolean outputOccupiedRangesOfBinaryPixels(byte[] binaryBits, int w, int h, RangesOutput out) {
131-
Set<Rectangle> rects = new HashSet<Rectangle>();
131+
Set<Rectangle> rects = new HashSet<>();
132132
Set<Rectangle> prevLine = Collections.<Rectangle>emptySet();
133133
int scanlineBytes = binaryBits.length / h;
134134
for (int row = 0; row < h; row++) {
135-
Set<Rectangle> curLine = new TreeSet<Rectangle>(COMPARATOR);
135+
Set<Rectangle> curLine = new TreeSet<>(COMPARATOR);
136136
int rowOffsetBytes = row * scanlineBytes;
137137
int startCol = -1;
138138
// Look at each batch of 8 columns in this row
@@ -201,10 +201,10 @@ public static boolean outputOccupiedRangesOfBinaryPixels(byte[] binaryBits, int
201201
* @return true if the output succeeded, false otherwise
202202
*/
203203
public static boolean outputOccupiedRanges(int[] pixels, int w, int h, int occupationMask, RangesOutput out) {
204-
Set<Rectangle> rects = new HashSet<Rectangle>();
204+
Set<Rectangle> rects = new HashSet<>();
205205
Set<Rectangle> prevLine = Collections.<Rectangle>emptySet();
206206
for (int row = 0; row < h; row++) {
207-
Set<Rectangle> curLine = new TreeSet<Rectangle>(COMPARATOR);
207+
Set<Rectangle> curLine = new TreeSet<>(COMPARATOR);
208208
int idxOffset = row * w;
209209
int startCol = -1;
210210

@@ -241,7 +241,7 @@ public static boolean outputOccupiedRanges(int[] pixels, int w, int h, int occup
241241
}
242242

243243
private static Set<Rectangle> mergeRects(Set<Rectangle> prev, Set<Rectangle> current) {
244-
Set<Rectangle> unmerged = new HashSet<Rectangle>(prev);
244+
Set<Rectangle> unmerged = new HashSet<>(prev);
245245
if (!prev.isEmpty() && !current.isEmpty()) {
246246
Rectangle[] pr = prev.toArray(new Rectangle[0]);
247247
Rectangle[] cr = current.toArray(new Rectangle[0]);

‎contrib/platform/src/com/sun/jna/platform/WindowUtils.java

Copy file name to clipboardExpand all lines: contrib/platform/src/com/sun/jna/platform/WindowUtils.java
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,9 +1043,9 @@ private void setMask(final Component w, final Area area) {
10431043
int mode = pi.getWindingRule() == PathIterator.WIND_NON_ZERO
10441044
? WinGDI.WINDING: WinGDI.ALTERNATE;
10451045
float[] coords = new float[6];
1046-
List<POINT> points = new ArrayList<POINT>();
1046+
List<POINT> points = new ArrayList<>();
10471047
int size = 0;
1048-
List<Integer> sizes = new ArrayList<Integer>();
1048+
List<Integer> sizes = new ArrayList<>();
10491049
while (!pi.isDone()) {
10501050
int type = pi.currentSegment(coords);
10511051
if (type == PathIterator.SEG_MOVETO) {
@@ -1239,7 +1239,7 @@ public Dimension getIconSize(final HICON hIcon) {
12391239

12401240
@Override
12411241
public List<DesktopWindow> getAllWindows(final boolean onlyVisibleWindows) {
1242-
final List<DesktopWindow> result = new LinkedList<DesktopWindow>();
1242+
final List<DesktopWindow> result = new LinkedList<>();
12431243

12441244
final WNDENUMPROC lpEnumFunc = new WNDENUMPROC() {
12451245
@Override
@@ -1576,7 +1576,7 @@ private static Pixmap createBitmap(final Display dpy,
15761576
}
15771577
x11.XSetForeground(dpy, gc, new NativeLong(0));
15781578
x11.XFillRectangle(dpy, pm, gc, 0, 0, width, height);
1579-
final List<Rectangle> rlist = new ArrayList<Rectangle>();
1579+
final List<Rectangle> rlist = new ArrayList<>();
15801580
try {
15811581
RasterRangesUtils.outputOccupiedRanges(raster, new RasterRangesUtils.RangesOutput() {
15821582
@Override
@@ -1686,7 +1686,7 @@ private synchronized long[] getAlphaVisualIDs() {
16861686
IntByReference pcount = new IntByReference();
16871687
info = x11.XGetVisualInfo(dpy, mask, template, pcount);
16881688
if (info != null) {
1689-
List<X11.VisualID> list = new ArrayList<X11.VisualID>();
1689+
List<X11.VisualID> list = new ArrayList<>();
16901690
XVisualInfo[] infos =
16911691
(XVisualInfo[])info.toArray(pcount.getValue());
16921692
for (int i = 0; i < infos.length; i++) {

‎contrib/platform/src/com/sun/jna/platform/bsd/ExtAttrUtil.java

Copy file name to clipboardExpand all lines: contrib/platform/src/com/sun/jna/platform/bsd/ExtAttrUtil.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public static void delete(String path, String name) throws IOException {
9595
}
9696

9797
private static List<String> decodeStringList(ByteBuffer buffer) {
98-
List<String> list = new ArrayList<String>();
98+
List<String> list = new ArrayList<>();
9999

100100
while (buffer.hasRemaining()) {
101101
int length = buffer.get() & 0xFF;

‎contrib/platform/src/com/sun/jna/platform/dnd/DropHandler.java

Copy file name to clipboardExpand all lines: contrib/platform/src/com/sun/jna/platform/dnd/DropHandler.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ public void drop(DropTargetDropEvent e) {
388388
* @return whether any of the given flavors are supported
389389
*/
390390
protected boolean isSupported(DataFlavor[] flavors) {
391-
Set<DataFlavor> set = new HashSet<DataFlavor>(Arrays.asList(flavors));
391+
Set<DataFlavor> set = new HashSet<>(Arrays.asList(flavors));
392392
set.retainAll(acceptedFlavors);
393393
return !set.isEmpty();
394394
}

‎contrib/platform/src/com/sun/jna/platform/linux/LibC.java

Copy file name to clipboardExpand all lines: contrib/platform/src/com/sun/jna/platform/linux/LibC.java
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class Sysinfo extends Structure {
7373
*/
7474
@Override
7575
protected List<Field> getFieldList() {
76-
List<Field> fields = new ArrayList<Field>(super.getFieldList());
76+
List<Field> fields = new ArrayList<>(super.getFieldList());
7777
if (PADDING_SIZE == 0) {
7878
Iterator<Field> fieldIterator = fields.iterator();
7979
while (fieldIterator.hasNext()) {
@@ -88,7 +88,7 @@ protected List<Field> getFieldList() {
8888

8989
@Override
9090
protected List<String> getFieldOrder() {
91-
List<String> fieldOrder = new ArrayList<String>(super.getFieldOrder());
91+
List<String> fieldOrder = new ArrayList<>(super.getFieldOrder());
9292
if (PADDING_SIZE == 0) {
9393
fieldOrder.remove("_f");
9494
}
@@ -122,7 +122,7 @@ class Statvfs extends Structure {
122122
*/
123123
@Override
124124
protected List<Field> getFieldList() {
125-
List<Field> fields = new ArrayList<Field>(super.getFieldList());
125+
List<Field> fields = new ArrayList<>(super.getFieldList());
126126
if (NativeLong.SIZE > 4) {
127127
Iterator<Field> fieldIterator = fields.iterator();
128128
while (fieldIterator.hasNext()) {
@@ -137,7 +137,7 @@ protected List<Field> getFieldList() {
137137

138138
@Override
139139
protected List<String> getFieldOrder() {
140-
List<String> fieldOrder = new ArrayList<String>(super.getFieldOrder());
140+
List<String> fieldOrder = new ArrayList<>(super.getFieldOrder());
141141
if (NativeLong.SIZE > 4) {
142142
fieldOrder.remove("_f_unused");
143143
}

‎contrib/platform/src/com/sun/jna/platform/linux/XAttrUtil.java

Copy file name to clipboardExpand all lines: contrib/platform/src/com/sun/jna/platform/linux/XAttrUtil.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,7 @@ public static void fRemoveXAttr(int fd, String name) throws IOException {
657657
private static Collection<String> splitBufferToStrings(byte[] valueMem, String encoding)
658658
throws IOException {
659659
final Charset charset = Charset.forName(encoding);
660-
final Set<String> attributesList = new LinkedHashSet<String>(1);
660+
final Set<String> attributesList = new LinkedHashSet<>(1);
661661
int offset = 0;
662662
for(int i = 0; i < valueMem.length; i++) {
663663
// each entry is terminated by a single \0 byte

‎contrib/platform/src/com/sun/jna/platform/mac/MacFileUtils.java

Copy file name to clipboardExpand all lines: contrib/platform/src/com/sun/jna/platform/mac/MacFileUtils.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class FSRef extends Structure {
6969

7070
@Override
7171
public void moveToTrash(File... files) throws IOException {
72-
List<String> failed = new ArrayList<String>();
72+
List<String> failed = new ArrayList<>();
7373
for (File src: files) {
7474
FileManager.FSRef fsref = new FileManager.FSRef();
7575
int status = FileManager.INSTANCE.FSPathMakeRefWithOptions(src.getAbsolutePath(),

‎contrib/platform/src/com/sun/jna/platform/mac/XAttrUtil.java

Copy file name to clipboardExpand all lines: contrib/platform/src/com/sun/jna/platform/mac/XAttrUtil.java
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public static List<String> listXAttr(String path) {
4141
return null;
4242

4343
if (bufferLength == 0)
44-
return new ArrayList<String>(0);
44+
return new ArrayList<>(0);
4545

4646
Memory valueBuffer = new Memory(bufferLength);
4747
long valueLength = XAttr.INSTANCE.listxattr(path, valueBuffer, bufferLength, 0);
@@ -97,7 +97,7 @@ protected static String decodeString(ByteBuffer bb) {
9797
}
9898

9999
protected static List<String> decodeStringSequence(ByteBuffer bb) {
100-
List<String> names = new ArrayList<String>();
100+
List<String> names = new ArrayList<>();
101101

102102
bb.mark(); // first key starts from here
103103
while (bb.hasRemaining()) {

‎contrib/platform/src/com/sun/jna/platform/unix/aix/SharedObjectLoader.java

Copy file name to clipboardExpand all lines: contrib/platform/src/com/sun/jna/platform/unix/aix/SharedObjectLoader.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ private static Map<String, Object> getOptions() {
5555
int RTLD_MEMBER = 0x40000; // allows "lib.a(obj.o)" syntax
5656
int RTLD_GLOBAL = 0x10000;
5757
int RTLD_LAZY = 0x4;
58-
Map<String, Object> options = new HashMap<String, Object>();
58+
Map<String, Object> options = new HashMap<>();
5959
options.put(Library.OPTION_OPEN_FLAGS, RTLD_MEMBER | RTLD_GLOBAL | RTLD_LAZY);
6060
return Collections.unmodifiableMap(options);
6161
}

‎contrib/platform/src/com/sun/jna/platform/win32/Advapi32Util.java

Copy file name to clipboardExpand all lines: contrib/platform/src/com/sun/jna/platform/win32/Advapi32Util.java
+8-8Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ public static Account[] getTokenGroups(HANDLE hToken) {
455455
tokenInformationLength.getValue(), tokenInformationLength)) {
456456
throw new Win32Exception(Kernel32.INSTANCE.GetLastError());
457457
}
458-
ArrayList<Account> userGroups = new ArrayList<Account>();
458+
ArrayList<Account> userGroups = new ArrayList<>();
459459
// make array of names
460460
for (SID_AND_ATTRIBUTES sidAndAttribute : groups.getGroups()) {
461461
Account group;
@@ -975,7 +975,7 @@ public static String[] registryGetStringArray(HKEY hKey, String value) {
975975
* @return An array of strings corresponding to the strings in the buffer.
976976
*/
977977
static String[] regMultiSzBufferToStringArray(Memory data) {
978-
ArrayList<String> result = new ArrayList<String>();
978+
ArrayList<String> result = new ArrayList<>();
979979
int offset = 0;
980980
while (offset < data.size()) {
981981
String s;
@@ -1995,7 +1995,7 @@ public static String[] registryGetKeys(HKEY hKey) {
19951995
if (rc != W32Errors.ERROR_SUCCESS) {
19961996
throw new Win32Exception(rc);
19971997
}
1998-
ArrayList<String> keys = new ArrayList<String>(lpcSubKeys.getValue());
1998+
ArrayList<String> keys = new ArrayList<>(lpcSubKeys.getValue());
19991999
char[] name = new char[lpcMaxSubKeyLen.getValue() + 1];
20002000
for (int i = 0; i < lpcSubKeys.getValue(); i++) {
20012001
IntByReference lpcchValueName = new IntByReference(
@@ -2129,7 +2129,7 @@ public static TreeMap<String, Object> registryGetValues(HKEY hKey) {
21292129
if (rc != W32Errors.ERROR_SUCCESS) {
21302130
throw new Win32Exception(rc);
21312131
}
2132-
TreeMap<String, Object> keyValues = new TreeMap<String, Object>();
2132+
TreeMap<String, Object> keyValues = new TreeMap<>();
21332133
char[] name = new char[lpcMaxValueNameLen.getValue() + 1];
21342134
// Allocate enough memory to hold largest value and two
21352135
// terminating WCHARs -- the memory is zeroed so after
@@ -2200,7 +2200,7 @@ public static TreeMap<String, Object> registryGetValues(HKEY hKey) {
22002200
break;
22012201
}
22022202
case WinNT.REG_MULTI_SZ: {
2203-
ArrayList<String> result = new ArrayList<String>();
2203+
ArrayList<String> result = new ArrayList<>();
22042204
int offset = 0;
22052205
while (offset < byteData.size()) {
22062206
String s;
@@ -2529,7 +2529,7 @@ public EventLogRecord(Pointer pevlr) {
25292529
}
25302530
// strings
25312531
if (_record.NumStrings.intValue() > 0) {
2532-
ArrayList<String> strings = new ArrayList<String>();
2532+
ArrayList<String> strings = new ArrayList<>();
25332533
int count = _record.NumStrings.intValue();
25342534
long offset = _record.StringOffset.intValue();
25352535
while (count > 0) {
@@ -2700,8 +2700,8 @@ public static ACE_HEADER[] getFileSecurity(String fileName,
27002700
ACE_HEADER[] aceStructures = dacl.getACEs();
27012701

27022702
if (compact) {
2703-
List<ACE_HEADER> result = new ArrayList<ACE_HEADER>();
2704-
Map<String, ACCESS_ACEStructure> aceMap = new HashMap<String, ACCESS_ACEStructure>();
2703+
List<ACE_HEADER> result = new ArrayList<>();
2704+
Map<String, ACCESS_ACEStructure> aceMap = new HashMap<>();
27052705
for (ACE_HEADER aceStructure : aceStructures) {
27062706
if (aceStructure instanceof ACCESS_ACEStructure) {
27072707
ACCESS_ACEStructure accessACEStructure = (ACCESS_ACEStructure) aceStructure;

‎contrib/platform/src/com/sun/jna/platform/win32/COM/COMUtils.java

Copy file name to clipboardExpand all lines: contrib/platform/src/com/sun/jna/platform/win32/COM/COMUtils.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ public static ArrayList<COMInfo> getAllCOMInfoOnSystem() {
222222
HKEYByReference phkResult = new HKEYByReference();
223223
HKEYByReference phkResult2 = new HKEYByReference();
224224
String subKey;
225-
ArrayList<COMInfo> comInfos = new ArrayList<COMUtils.COMInfo>();
225+
ArrayList<COMInfo> comInfos = new ArrayList<>();
226226

227227
try {
228228
// open root key

‎contrib/platform/src/com/sun/jna/platform/win32/COM/WbemcliUtil.java

Copy file name to clipboardExpand all lines: contrib/platform/src/com/sun/jna/platform/win32/COM/WbemcliUtil.java
+7-7Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -284,12 +284,12 @@ private static <T extends Enum<T>> IEnumWbemClassObject selectProperties(IWbemSe
284284
*/
285285
private static <T extends Enum<T>> WmiResult<T> enumerateProperties(IEnumWbemClassObject enumerator,
286286
Class<T> propertyEnum, int timeout) throws TimeoutException {
287-
WmiResult<T> values = INSTANCE.new WmiResult<T>(propertyEnum);
287+
WmiResult<T> values = INSTANCE.new WmiResult<>(propertyEnum);
288288
// Step 7: -------------------------------------------------
289289
// Get the data from the query in step 6 -------------------
290290
Pointer[] pclsObj = new Pointer[1];
291291
IntByReference uReturn = new IntByReference(0);
292-
Map<T, WString> wstrMap = new HashMap<T, WString>();
292+
Map<T, WString> wstrMap = new HashMap<>();
293293
HRESULT hres = null;
294294
for (T property : propertyEnum.getEnumConstants()) {
295295
wstrMap.put(property, new WString(property.name()));
@@ -381,11 +381,11 @@ public class WmiResult<T extends Enum<T>> {
381381
* The enum associated with this map
382382
*/
383383
public WmiResult(Class<T> propertyEnum) {
384-
propertyMap = new EnumMap<T, List<Object>>(propertyEnum);
385-
vtTypeMap = new EnumMap<T, Integer>(propertyEnum);
386-
cimTypeMap = new EnumMap<T, Integer>(propertyEnum);
384+
propertyMap = new EnumMap<>(propertyEnum);
385+
vtTypeMap = new EnumMap<>(propertyEnum);
386+
cimTypeMap = new EnumMap<>(propertyEnum);
387387
for (T prop : propertyEnum.getEnumConstants()) {
388-
propertyMap.put(prop, new ArrayList<Object>());
388+
propertyMap.put(prop, new ArrayList<>());
389389
vtTypeMap.put(prop, Variant.VT_NULL);
390390
cimTypeMap.put(prop, Wbemcli.CIM_EMPTY);
391391
}
@@ -486,7 +486,7 @@ public static boolean hasNamespace(String namespace) {
486486
ns = namespace.substring(5);
487487
}
488488
// Test
489-
WmiQuery<NamespaceProperty> namespaceQuery = new WmiQuery<NamespaceProperty>("ROOT", "__NAMESPACE", NamespaceProperty.class);
489+
WmiQuery<NamespaceProperty> namespaceQuery = new WmiQuery<>("ROOT", "__NAMESPACE", NamespaceProperty.class);
490490
WmiResult<NamespaceProperty> namespaces = namespaceQuery.execute();
491491
for (int i = 0; i < namespaces.getResultCount(); i++) {
492492
if (ns.equalsIgnoreCase((String) namespaces.getValue(NamespaceProperty.NAME, i))) {

‎contrib/platform/src/com/sun/jna/platform/win32/COM/util/ComThread.java

Copy file name to clipboardExpand all lines: contrib/platform/src/com/sun/jna/platform/win32/COM/util/ComThread.java
+2-4Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
import com.sun.jna.platform.win32.COM.COMUtils;
3838

3939
public class ComThread {
40-
private static ThreadLocal<Boolean> isCOMThread = new ThreadLocal<Boolean>();
40+
private static ThreadLocal<Boolean> isCOMThread = new ThreadLocal<>();
4141

4242
ExecutorService executor;
4343
Runnable firstTask;
@@ -116,9 +116,7 @@ public void run() {
116116

117117
executor.shutdown();
118118

119-
} catch (InterruptedException e) {
120-
e.printStackTrace();
121-
} catch (ExecutionException e) {
119+
} catch (InterruptedException | ExecutionException e) {
122120
e.printStackTrace();
123121
} catch (TimeoutException e) {
124122
executor.shutdownNow();

‎contrib/platform/src/com/sun/jna/platform/win32/COM/util/Factory.java

Copy file name to clipboardExpand all lines: contrib/platform/src/com/sun/jna/platform/win32/COM/util/Factory.java
+1-3Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,7 @@ public IRunningObjectTable getRunningObjectTable() {
170170
private <T> T runInComThread(Callable<T> callable) {
171171
try {
172172
return comThread.execute(callable);
173-
} catch (TimeoutException ex) {
174-
throw new RuntimeException(ex);
175-
} catch (InterruptedException ex) {
173+
} catch (TimeoutException | InterruptedException ex) {
176174
throw new RuntimeException(ex);
177175
} catch (ExecutionException ex) {
178176
Throwable cause = ex.getCause();

‎contrib/platform/src/com/sun/jna/platform/win32/COM/util/ObjectFactory.java

Copy file name to clipboardExpand all lines: contrib/platform/src/com/sun/jna/platform/win32/COM/util/ObjectFactory.java
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,11 +180,11 @@ IDispatchCallback createDispatchCallback(Class<?> comEventCallbackInterface, ICo
180180
// environment and can't be used anymore. registeredObjects is used
181181
// to dispose interfaces even if garbadge collection has not yet collected
182182
// the proxy objects.
183-
private final List<WeakReference<ProxyObject>> registeredObjects = new LinkedList<WeakReference<ProxyObject>>();
183+
private final List<WeakReference<ProxyObject>> registeredObjects = new LinkedList<>();
184184

185185
public void register(ProxyObject proxyObject) {
186186
synchronized (this.registeredObjects) {
187-
this.registeredObjects.add(new WeakReference<ProxyObject>(proxyObject));
187+
this.registeredObjects.add(new WeakReference<>(proxyObject));
188188
}
189189
}
190190

@@ -203,7 +203,7 @@ public void unregister(ProxyObject proxyObject) {
203203

204204
public void disposeAll() {
205205
synchronized (this.registeredObjects) {
206-
List<WeakReference<ProxyObject>> s = new ArrayList<WeakReference<ProxyObject>>(this.registeredObjects);
206+
List<WeakReference<ProxyObject>> s = new ArrayList<>(this.registeredObjects);
207207
for (WeakReference<ProxyObject> weakRef : s) {
208208
ProxyObject po = weakRef.get();
209209
if (po != null) {

‎contrib/platform/src/com/sun/jna/platform/win32/COM/util/RunningObjectTable.java

Copy file name to clipboardExpand all lines: contrib/platform/src/com/sun/jna/platform/win32/COM/util/RunningObjectTable.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public Iterable<IDispatch> enumRunning() {
6060
public <T> List<T> getActiveObjectsByInterface(Class<T> comInterface) {
6161
assert COMUtils.comIsInitialized() : "COM not initialized";
6262

63-
List<T> result = new ArrayList<T>();
63+
List<T> result = new ArrayList<>();
6464

6565
for (IDispatch obj : this.enumRunning()) {
6666
try {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.