Skip to content
Commits on Source (4)
......@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.swt.tools.base;singleton:=true
Bundle-Version: 3.106.0.qualifier
Bundle-Version: 3.107.0.qualifier
Bundle-ManifestVersion: 2
Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin
......
......@@ -14,11 +14,11 @@
<parent>
<artifactId>eclipse.platform.swt.localbuild</artifactId>
<groupId>eclipse.platform.swt</groupId>
<version>4.7.3-SNAPSHOT</version>
<version>4.8.0-SNAPSHOT</version>
<relativePath>../../local-build/local-build-parent/</relativePath>
</parent>
<groupId>org.eclipse.swt</groupId>
<artifactId>org.eclipse.swt.tools.base</artifactId>
<version>3.106.0-SNAPSHOT</version>
<version>3.107.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
......@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.swt.tools.spies;singleton:=true
Bundle-Version: 3.106.0.qualifier
Bundle-Version: 3.106.100.qualifier
Bundle-ManifestVersion: 2
Export-Package: org.eclipse.swt.tools.internal,
org.eclipse.swt.tools.views
......@@ -12,3 +12,4 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: org.eclipse.core.runtime;bundle-version="3.4.0",
org.eclipse.ui;bundle-version="3.4.0",
org.eclipse.swt.tools.base;bundle-version="3.106.0"
Automatic-Module-Name: org.eclipse.swt.tools.spies
Bug 510973 - Missing source bundle for org.eclipse.swt.tools
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2012, 2015 Eclipse Foundation and others.
Copyright (c) 2012, 2017 Eclipse Foundation and others.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Distribution License v1.0
which accompanies this distribution, and is available at
......@@ -14,11 +14,11 @@
<parent>
<artifactId>eclipse.platform.swt.localbuild</artifactId>
<groupId>eclipse.platform.swt</groupId>
<version>4.7.3-SNAPSHOT</version>
<version>4.8.0-SNAPSHOT</version>
<relativePath>../../local-build/local-build-parent/</relativePath>
</parent>
<groupId>org.eclipse.swt</groupId>
<artifactId>org.eclipse.swt.tools.spies</artifactId>
<version>3.106.0-SNAPSHOT</version>
<version>3.106.100-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
......@@ -64,7 +64,7 @@ public class SpyView extends ViewPart {
Display display = output.getDisplay();
Control control = display.getCursorControl();
if (control != lastControl) {
StringBuffer text = new StringBuffer();
StringBuilder text = new StringBuilder();
if (control != null) {
text.append(getName(control)+"@"+getOSHandle(control)+"\n");
text.append("\tStyle: "+getStyle(control)+"\n");
......
......@@ -5,7 +5,6 @@
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="JNI Generation"/>
<classpathentry kind="src" path="Mac Generation"/>
<classpathentry kind="src" path="Mozilla Generation"/>
<classpathentry kind="src" path="NativeStats"/>
<classpathentry kind="src" path="Icon Exe"/>
<classpathentry kind="src" path="JavadocBasher"/>
......
......@@ -2,8 +2,11 @@ eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
org.eclipse.jdt.core.compiler.annotation.nonnull.secondary=
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary=
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
......@@ -22,7 +25,7 @@ org.eclipse.jdt.core.compiler.problem.deprecation=warning
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
......@@ -35,11 +38,11 @@ org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
......@@ -50,12 +53,14 @@ org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning
org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
org.eclipse.jdt.core.compiler.problem.nullReference=warning
org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
......@@ -63,7 +68,7 @@ org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
......@@ -78,10 +83,13 @@ org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled
org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
......@@ -90,12 +98,12 @@ org.eclipse.jdt.core.compiler.problem.unusedImport=warning
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedParameter=warning
org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=warning
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.source=1.8
/*******************************************************************************
* Copyright (c) 2000, 2015 IBM Corporation and others.
* Copyright (c) 2000, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
......@@ -7,11 +7,14 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
* Torbjörn Svensson (STMicroelectronics) - bug #461646
*******************************************************************************/
package org.eclipse.swt.tools.internal;
import java.io.*;
import org.eclipse.swt.*;
/**
* Customize the icon of a Windows exe
*
......@@ -241,7 +244,7 @@ void dumpResourceDirectory(RandomAccessFile raf, int imageResourceDirectoryOffse
if (rt_icon_root) {
if (DEBUG) System.out.println("iconcnt "+iconCnt+" |"+iconInfo.length);
iconInfo[iconCnt] = new IconResInfo();
iconInfo[iconCnt].data = parseIcon(raf, data.OffsetToData - delta, data.Size);
iconInfo[iconCnt].data = parseIcon(raf, data.OffsetToData - delta);
iconInfo[iconCnt].offset = data.OffsetToData - delta;
iconInfo[iconCnt].size = data.Size;
iconCnt++;
......@@ -255,7 +258,7 @@ void dumpResourceDirectory(RandomAccessFile raf, int imageResourceDirectoryOffse
}
}
static ImageData parseIcon(RandomAccessFile raf, int offset, int size) throws IOException {
static ImageData parseIcon(RandomAccessFile raf, int offset) throws IOException {
raf.seek(offset);
BITMAPINFO bitmapInfo = new BITMAPINFO();
read(raf, bitmapInfo);
......@@ -443,7 +446,7 @@ static void unloadShapeData(RandomAccessFile raf, ImageData icon) {
SWT.error(SWT.ERROR_IO, e);
}
}
static boolean readIconGroup(RandomAccessFile raf, int offset, int size) throws IOException {
static boolean readIconGroup(RandomAccessFile raf, int offset) throws IOException {
raf.seek(offset);
NEWHEADER newHeader = new NEWHEADER();
read(raf, newHeader);
......@@ -1009,7 +1012,7 @@ public int getPixel(RGB rgb) {
pixel |= (greenShift < 0 ? rgb.green << -greenShift : rgb.green >>> greenShift) & greenMask;
pixel |= (blueShift < 0 ? rgb.blue << -blueShift : rgb.blue >>> blueShift) & blueMask;
return pixel;
} else {
}
for (int i = 0; i < colors.length; i++) {
if (colors[i].equals(rgb)) return i;
}
......@@ -1017,7 +1020,6 @@ public int getPixel(RGB rgb) {
SWT.error(SWT.ERROR_INVALID_ARGUMENT);
return 0;
}
}
/**
* Returns an <code>RGB</code> corresponding to the given pixel value.
......@@ -1039,13 +1041,12 @@ public RGB getRGB(int pixel) {
int b = pixel & blueMask;
b = (blueShift < 0) ? b >>> -blueShift : b << blueShift;
return new RGB(r, g, b);
} else {
}
if (pixel < 0 || pixel >= colors.length) {
SWT.error(SWT.ERROR_INVALID_ARGUMENT);
}
return colors[pixel];
}
}
/**
* Returns all the RGB values in the receiver if it is an
......@@ -1987,9 +1988,8 @@ public RGB[] getRGBs() {
public ImageData getTransparencyMask() {
if (getTransparencyType() == SWT.TRANSPARENCY_MASK) {
return new ImageData(width, height, 1, bwPalette(), maskPad, maskData);
} else {
return colorMaskImage(transparentPixel);
}
return colorMaskImage(transparentPixel);
}
/**
......@@ -2781,8 +2781,6 @@ int decompressRLE4Data(byte[] src, int numBytes, int stride, byte[] dest, int de
y++;
x = 0;
dp = y * stride;
if (dp >= de)
return -1;
break;
case 1: /* end of bitmap */
return 1;
......@@ -2847,8 +2845,6 @@ int decompressRLE8Data(byte[] src, int numBytes, int stride, byte[] dest, int de
y++;
x = 0;
dp = y * stride;
if (dp >= de)
return -1;
break;
case 1: /* end of bitmap */
return 1;
......@@ -3280,7 +3276,7 @@ static class SWT {
throw new RuntimeException("Error "+code);
}
public static void error(int code, Throwable t) {
throw new RuntimeException(t);
throw new RuntimeException("Error " + code, t);
}
}
}
/*******************************************************************************
* Copyright (c) 2004, 2015 IBM Corporation and others.
* Copyright (c) 2004, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
......@@ -79,8 +79,7 @@ public ASTClass(String sourcePath, MetaData metaData) {
List<ImportDeclaration> imports = unit.imports();
this.imports = new String[imports.size()];
int count = 0;
for (Iterator<ImportDeclaration> iterator = imports.iterator(); iterator.hasNext();) {
ImportDeclaration imp = iterator.next();
for (ImportDeclaration imp : imports) {
this.imports[count++] = imp.getName().getFullyQualifiedName();
}
start = type.getStartPosition();
......@@ -89,8 +88,7 @@ public ASTClass(String sourcePath, MetaData metaData) {
List<TagElement> tags = null;
if (doc != null) {
tags = doc.tags();
for (Iterator<TagElement> iterator = tags.iterator(); iterator.hasNext();) {
TagElement tag = iterator.next();
for (TagElement tag : tags) {
if ("@jniclass".equals(tag.getTagName())) {
String data = tag.fragments().get(0).toString();
setMetaData(data);
......@@ -104,8 +102,7 @@ public ASTClass(String sourcePath, MetaData metaData) {
for (int i = 0; i < fields.length; i++) {
FieldDeclaration field = fields[i];
List<VariableDeclarationFragment> fragments = field.fragments();
for (Iterator<VariableDeclarationFragment> iterator = fragments.iterator(); iterator.hasNext();) {
VariableDeclarationFragment fragment = iterator.next();
for (VariableDeclarationFragment fragment : fragments) {
fid.add(new ASTField(this, source, field, fragment));
}
}
......
/*******************************************************************************
* Copyright (c) 2004, 2015 IBM Corporation and others.
* Copyright (c) 2004, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
......@@ -32,8 +32,7 @@ public ASTField(ASTClass declaringClass, String source, FieldDeclaration field,
List<TagElement> tags = null;
if (doc != null) {
tags = doc.tags();
for (Iterator<TagElement> iterator = tags.iterator(); iterator.hasNext();) {
TagElement tag = iterator.next();
for (TagElement tag : tags) {
if ("@field".equals(tag.getTagName())) {
String data = tag.fragments().get(0).toString();
setMetaData(data);
......
/*******************************************************************************
* Copyright (c) 2004, 2015 IBM Corporation and others.
* Copyright (c) 2004, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
......@@ -37,8 +37,7 @@ public ASTMethod(ASTClass declaringClass, String source, MethodDeclaration metho
List<TagElement> tags = null;
if (doc != null) {
tags = doc.tags();
for (Iterator<TagElement> iterator = tags.iterator(); iterator.hasNext();) {
TagElement tag = iterator.next();
for (TagElement tag : tags) {
if ("@method".equals(tag.getTagName())) {
String data = tag.fragments().get(0).toString();
setMetaData(data);
......@@ -83,8 +82,7 @@ public ASTMethod(ASTClass declaringClass, String source, MethodDeclaration metho
}
if (tags != null) {
String name = param.getName().getIdentifier();
for (Iterator<TagElement> iterator1 = tags.iterator(); iterator1.hasNext();) {
TagElement tag = iterator1.next();
for (TagElement tag : tags) {
if ("@param".equals(tag.getTagName())) {
List<?> fragments = tag.fragments();
if (name.equals(fragments.get(0).toString())) {
......
/*******************************************************************************
* Copyright (c) 2008, 2015 IBM Corporation and others.
* Copyright (c) 2008, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
......@@ -27,7 +27,7 @@ void checkParams() {
public String flatten() {
checkParams();
StringBuffer buffer = new StringBuffer();
StringBuilder buffer = new StringBuilder();
Set<String> set = params.keySet();
String[] keys = set.toArray(new String[set.size()]);
Arrays.sort(keys);
......@@ -39,7 +39,7 @@ public String flatten() {
valueStr = (String)value;
} else if (value instanceof String[]) {
String[] values = (String[])value;
StringBuffer valueBuffer = new StringBuffer();
StringBuilder valueBuffer = new StringBuilder();
for (int i = 0; i < values.length; i++) {
if (i != 0) valueBuffer.append(" ");
valueBuffer.append(values[i]);
......
/*******************************************************************************
* Copyright (c) 2004, 2015 IBM Corporation and others.
* Copyright (c) 2004, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
......@@ -80,7 +80,7 @@ void loadFiles () {
String loadFile (File file) {
try (FileReader fr = new FileReader(file);
BufferedReader br = new BufferedReader(fr)){
StringBuffer str = new StringBuffer();
StringBuilder str = new StringBuilder();
char[] buffer = new char[1024];
int read;
while ((read = br.read(buffer)) != -1) {
......@@ -96,6 +96,9 @@ String loadFile (File file) {
void loadDirectory(File file) {
String[] entries = file.list();
if (entries == null) {
entries = new String[0];
}
for (int i = 0; i < entries.length; i++) {
String entry = entries[i];
File f = new File(file, entry);
......
/*******************************************************************************
* Copyright (c) 2004, 2015 IBM Corporation and others.
* Copyright (c) 2004, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
......@@ -11,9 +11,7 @@
*******************************************************************************/
package org.eclipse.swt.tools.internal;
import java.io.*;
import java.lang.reflect.*;
import java.util.*;
public class CleanupConstants extends CleanupClass {
......@@ -51,10 +49,7 @@ public void generate(JNIField[] fields) {
public void generate(JNIField field) {
String name = field.getName();
Iterator<File> keys = files.keySet().iterator();
while (keys.hasNext()) {
File key = keys.next();
String str = files.get(key);
for (String str : files.values()) {
if (str.indexOf(name) != -1) {
int modifiers = field.getModifiers();
String modifiersStr = Modifier.toString(modifiers);
......
/*******************************************************************************
* Copyright (c) 2004, 2015 IBM Corporation and others.
* Copyright (c) 2004, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
......@@ -11,9 +11,7 @@
*******************************************************************************/
package org.eclipse.swt.tools.internal;
import java.io.*;
import java.lang.reflect.*;
import java.util.*;
public class CleanupNatives extends CleanupClass {
......@@ -40,10 +38,7 @@ public void generate(JNIMethod[] methods) {
public void generate(JNIMethod method) {
String name = method.getName();
Iterator<File> keys = files.keySet().iterator();
while (keys.hasNext()) {
File key = keys.next();
String str = files.get(key);
for (String str : files.values()) {
if (str.indexOf(name) != -1) {
// int modifiers = method.getModifiers();
// Class clazz = method.getDeclaringClass();
......
/*******************************************************************************
* Copyright (c) 2008, 2016 IBM Corporation and others.
* Copyright (c) 2008, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
......@@ -35,9 +35,8 @@ public void generate(JNIClass clazz) {
List<Integer> keys = new ArrayList<>();
keys.addAll(set);
Collections.reverse(keys);
StringBuffer buffer = new StringBuffer(source);
for (Iterator<Integer> iterator = keys.iterator(); iterator.hasNext();) {
Integer index = iterator.next();
StringBuilder buffer = new StringBuilder(source);
for (Integer index : keys) {
String doc = inserts.get(index);
buffer.insert(index.intValue(), doc);
}
......@@ -99,11 +98,10 @@ public void generate(JNIMethod method) {
String doc = "/** " + tags.get(0) + " */" + delimiter;
inserts.put(Integer.valueOf(((ASTMethod)method).start), doc);
} else {
StringBuffer buffer = new StringBuffer();
StringBuilder buffer = new StringBuilder();
buffer.append("/**");
buffer.append(delimiter);
for (Iterator<String> iterator = tags.iterator(); iterator.hasNext();) {
String tag = iterator.next();
for (String tag : tags) {
buffer.append(" * ");
buffer.append(tag);
buffer.append(delimiter);
......
/*******************************************************************************
* Copyright (c) 2004, 2016 IBM Corporation and others.
* Copyright (c) 2004, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
......@@ -33,7 +33,7 @@ public JNIGenerator() {
public static String skipCopyrights(InputStream is) throws IOException {
int state = 0;
StringBuffer copyrights = new StringBuffer();
StringBuilder copyrights = new StringBuilder();
while (state != 5) {
int c = is.read();
if (c == -1) return null;
......@@ -93,9 +93,8 @@ public static String getDelimiter(String fileName) {
int c1 = is.read();
if (c1 == '\n') {
return "\r\n";
} else {
return "\r";
}
return "\r";
}
}
} catch (IOException e) {
......@@ -106,7 +105,7 @@ public static String getDelimiter(String fileName) {
String fixDelimiter(String str) {
if (delimiter.equals("\n")) return str;
int index = 0, length = str.length();
StringBuffer buffer = new StringBuffer();
StringBuilder buffer = new StringBuilder();
while (index != -1) {
int start = index;
index = str.indexOf('\n', start);
......@@ -129,7 +128,7 @@ static String getFunctionName(JNIMethod method, JNIType[] paramTypes) {
if ((method.getModifiers() & Modifier.NATIVE) == 0) return method.getName();
String function = toC(method.getName());
if (!method.isNativeUnique()) {
StringBuffer buffer = new StringBuffer();
StringBuilder buffer = new StringBuilder();
buffer.append(function);
buffer.append("__");
for (int i = 0; i < paramTypes.length; i++) {
......@@ -144,7 +143,7 @@ static String getFunctionName(JNIMethod method, JNIType[] paramTypes) {
static String loadFile (String file) {
try (FileReader fr = new FileReader(file);
BufferedReader br = new BufferedReader(fr)){
StringBuffer str = new StringBuffer();
StringBuilder str = new StringBuilder();
char[] buffer = new char[1024];
int read;
while ((read = br.read(buffer)) != -1) {
......@@ -183,7 +182,7 @@ static String[] split(String str, String separator) {
static String toC(String str) {
int length = str.length();
StringBuffer buffer = new StringBuffer(length * 2);
StringBuilder buffer = new StringBuilder(length * 2);
for (int i = 0; i < length; i++) {
char c = str.charAt(i);
switch (c) {
......
/*******************************************************************************
* Copyright (c) 2004, 2015 IBM Corporation and others.
* Copyright (c) 2004, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
......@@ -11,10 +11,10 @@
package org.eclipse.swt.tools.internal;
import java.io.*;
import java.lang.reflect.*;
import java.util.*;
import java.util.zip.*;
import org.eclipse.jdt.core.dom.*;
import org.eclipse.swt.*;
public class JNIGeneratorApp {
......@@ -259,14 +259,14 @@ public void generate(ProgressMonitor progress) {
this.progress = null;
}
String getPackageName(String className) {
String getPackageName() {
int dot = mainClassName.lastIndexOf('.');
if (dot == -1) return "";
return mainClassName.substring(0, dot);
}
String[] getClassNames(String mainClassName) {
String pkgName = getPackageName(mainClassName);
String[] getClassNames() {
String pkgName = getPackageName();
String classpath = getClasspath();
if (classpath == null) classpath = System.getProperty("java.class.path");
String pkgPath = pkgName.replace('.', File.separatorChar);
......@@ -296,6 +296,9 @@ String[] getClassNames(String mainClassName) {
File file = new File(path + File.separator + pkgPath);
if (file.exists()) {
String[] entries = file.list();
if(entries == null) {
entries = new String[0];
}
for (int i = 0; i < entries.length; i++) {
String entry = entries[i];
File f = new File(file, entry);
......@@ -317,9 +320,9 @@ public JNIClass[] getClasses() {
if (classes != null) return classes;
if (mainClassName == null) return new JNIClass[0];
if (USE_AST) return getASTClasses();
String[] classNames = getClassNames(mainClassName);
String[] classNames = getClassNames();
Arrays.sort(classNames);
String packageName = getPackageName(mainClassName);
String packageName = getPackageName();
JNIClass[] classes = new JNIClass[classNames.length];
for (int i = 0; i < classNames.length; i++) {
String className = classNames[i];
......@@ -345,9 +348,12 @@ JNIClass[] getASTClasses() {
String root = classesDir != null ? classesDir : new File(outputDir).getParent() + "/";
String mainPath = new File(root + mainClassName.replace('.', '/') + ".java").getAbsolutePath();
List<JNIClass> classes = new ArrayList<>();
String packageName = getPackageName(mainClassName);
String packageName = getPackageName();
File dir = new File(root + "/" + packageName.replace('.', '/'));
File[] files = dir.listFiles();
if (files == null) {
files = new File[0];
}
for (int i = 0; i < files.length; i++) {
File file = files[i];
try {
......@@ -356,7 +362,13 @@ JNIClass[] getASTClasses() {
if (mainPath.equals(path)){
classes.add(mainClass);
} else {
try {
classes.add(new ASTClass(path, metaData));
} catch (ClassCastException cce) {
if (cce.getMessage().startsWith(EnumDeclaration.class.getName())) {
// this can be ignored since enums don't affect native files
}
}
}
}
} catch (Exception e) {
......
/*******************************************************************************
* Copyright (c) 2004, 2016 IBM Corporation and others.
* Copyright (c) 2004, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
......@@ -899,7 +899,7 @@ public void run() {
cleanup();
}
String getPackageString(String className) {
String getPackageString() {
int dot = app.getMainClassName().lastIndexOf('.');
if (dot == -1) return "";
return app.getMainClassName().substring(0, dot);
......@@ -914,7 +914,7 @@ String getClassString(JNIType type) {
String getFlagsString(String[] flags) {
if (flags.length == 0) return "";
StringBuffer buffer = new StringBuffer();
StringBuilder buffer = new StringBuilder();
for (int j = 0; j < flags.length; j++) {
String flag = flags[j];
if (buffer.length() != 0) buffer.append(", ");
......@@ -924,8 +924,8 @@ String getFlagsString(String[] flags) {
}
String getMethodString(JNIMethod method) {
String pkgName = getPackageString(method.getDeclaringClass().getName());
StringBuffer buffer = new StringBuffer();
String pkgName = getPackageString();
StringBuilder buffer = new StringBuilder();
buffer.append(method.getName());
buffer.append("(");
JNIParameter[] params = method.getParameters();
......