Skip to content

Commit 08768d4

Browse files
processor sources are unmaintained in j.compiler.apt.tests (#4753)
+ refresh git-manages sources from jar files + unify LF (unix) + clean-up: whitespace, imports, diamond, StringBuffer -> StringBuilder + run Create Jar on *.jardesc + remove stale build files #4751
1 parent 504752c commit 08768d4

File tree

24 files changed

+81
-152
lines changed

24 files changed

+81
-152
lines changed

org.eclipse.jdt.compiler.apt.tests/.externalToolBuilders/Build processors jar.launch

Lines changed: 0 additions & 20 deletions
This file was deleted.

org.eclipse.jdt.compiler.apt.tests/.project

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,6 @@
2020
<arguments>
2121
</arguments>
2222
</buildCommand>
23-
<buildCommand>
24-
<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
25-
<triggers>full,incremental,</triggers>
26-
<arguments>
27-
<dictionary>
28-
<key>LaunchConfigHandle</key>
29-
<value>&lt;project&gt;/.externalToolBuilders/Build processors jar.launch</value>
30-
</dictionary>
31-
</arguments>
32-
</buildCommand>
3323
</buildSpec>
3424
<natures>
3525
<nature>org.eclipse.pde.PluginNature</nature>

org.eclipse.jdt.compiler.apt.tests/apttestprocessors8.jardesc

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,20 @@
1111
</sealing>
1212
</manifest>
1313
<selectedElements exportClassFiles="true" exportJavaFiles="true" exportOutputFolder="false">
14-
<javaElement handleIdentifier="=org.eclipse.jdt.compiler.apt.tests/processors=/test=/true=/&lt;org.eclipse.jdt.compiler.apt.tests.processors.visitors"/>
14+
<javaElement handleIdentifier="=org.eclipse.jdt.compiler.apt.tests/processors=/test=/true=/&lt;org.eclipse.jdt.compiler.apt.tests.annotations"/>
15+
<javaElement handleIdentifier="=org.eclipse.jdt.compiler.apt.tests/processors=/test=/true=/&lt;org.eclipse.jdt.compiler.apt.tests.processors.base"/>
16+
<javaElement handleIdentifier="=org.eclipse.jdt.compiler.apt.tests/processors=/test=/true=/&lt;org.eclipse.jdt.compiler.apt.tests.processors.checkargs"/>
17+
<javaElement handleIdentifier="=org.eclipse.jdt.compiler.apt.tests/processors=/test=/true=/&lt;org.eclipse.jdt.compiler.apt.tests.processors.elements"/>
1518
<javaElement handleIdentifier="=org.eclipse.jdt.compiler.apt.tests/processors=/test=/true=/&lt;org.eclipse.jdt.compiler.apt.tests.processors.elementutils"/>
1619
<javaElement handleIdentifier="=org.eclipse.jdt.compiler.apt.tests/processors=/test=/true=/&lt;org.eclipse.jdt.compiler.apt.tests.processors.filer"/>
17-
<javaElement handleIdentifier="=org.eclipse.jdt.compiler.apt.tests/processors=/test=/true=/&lt;org.eclipse.jdt.compiler.apt.tests.processors.elements"/>
18-
<javaElement handleIdentifier="=org.eclipse.jdt.compiler.apt.tests/processors8=/test=/true=/"/>
19-
<javaElement handleIdentifier="=org.eclipse.jdt.compiler.apt.tests/processors=/test=/true=/&lt;org.eclipse.jdt.compiler.apt.tests.processors.typemirror"/>
20+
<javaElement handleIdentifier="=org.eclipse.jdt.compiler.apt.tests/processors=/test=/true=/&lt;org.eclipse.jdt.compiler.apt.tests.processors.genclass"/>
2021
<javaElement handleIdentifier="=org.eclipse.jdt.compiler.apt.tests/processors=/test=/true=/&lt;org.eclipse.jdt.compiler.apt.tests.processors.generics"/>
21-
<javaElement handleIdentifier="=org.eclipse.jdt.compiler.apt.tests/processors=/test=/true=/&lt;org.eclipse.jdt.compiler.apt.tests.processors.checkargs"/>
22+
<javaElement handleIdentifier="=org.eclipse.jdt.compiler.apt.tests/processors=/test=/true=/&lt;org.eclipse.jdt.compiler.apt.tests.processors.inherited"/>
23+
<javaElement handleIdentifier="=org.eclipse.jdt.compiler.apt.tests/processors=/test=/true=/&lt;org.eclipse.jdt.compiler.apt.tests.processors.messager"/>
2224
<javaElement handleIdentifier="=org.eclipse.jdt.compiler.apt.tests/processors=/test=/true=/&lt;org.eclipse.jdt.compiler.apt.tests.processors.negative"/>
23-
<javaElement handleIdentifier="=org.eclipse.jdt.compiler.apt.tests/processors=/test=/true=/&lt;org.eclipse.jdt.compiler.apt.tests.processors.genclass"/>
25+
<javaElement handleIdentifier="=org.eclipse.jdt.compiler.apt.tests/processors=/test=/true=/&lt;org.eclipse.jdt.compiler.apt.tests.processors.typemirror"/>
2426
<javaElement handleIdentifier="=org.eclipse.jdt.compiler.apt.tests/processors=/test=/true=/&lt;org.eclipse.jdt.compiler.apt.tests.processors.typeutils"/>
25-
<javaElement handleIdentifier="=org.eclipse.jdt.compiler.apt.tests/processors=/test=/true=/&lt;org.eclipse.jdt.compiler.apt.tests.processors.messager"/>
26-
<javaElement handleIdentifier="=org.eclipse.jdt.compiler.apt.tests/processors=/test=/true=/&lt;org.eclipse.jdt.compiler.apt.tests.processors.base"/>
27-
<javaElement handleIdentifier="=org.eclipse.jdt.compiler.apt.tests/processors=/test=/true=/&lt;org.eclipse.jdt.compiler.apt.tests.processors.inherited"/>
28-
<javaElement handleIdentifier="=org.eclipse.jdt.compiler.apt.tests/processors=/test=/true=/&lt;org.eclipse.jdt.compiler.apt.tests.annotations"/>
27+
<javaElement handleIdentifier="=org.eclipse.jdt.compiler.apt.tests/processors=/test=/true=/&lt;org.eclipse.jdt.compiler.apt.tests.processors.visitors"/>
28+
<javaElement handleIdentifier="=org.eclipse.jdt.compiler.apt.tests/processors8=/test=/true=/"/>
2929
</selectedElements>
3030
</jardesc>
4.64 KB
Binary file not shown.
-836 Bytes
Binary file not shown.

org.eclipse.jdt.compiler.apt.tests/processors/org/eclipse/jdt/compiler/apt/tests/annotations/GenClass.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
* If {@code warn == true}, the processor produces source code that will cause a
2323
* warning about an unused variable when compiled (if the warning is enabled).
2424
* </p>
25-
*
25+
*
2626
* @see org.eclipse.jdt.compiler.apt.tests.processors.genclass.GenClassProc
2727
*/
2828
public @interface GenClass {

org.eclipse.jdt.compiler.apt.tests/processors/org/eclipse/jdt/compiler/apt/tests/processors/AnnotationProcessorTests/Bug340635Proc.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment
6666
return ALLOW_OTHER_PROCESSORS_TO_PROCESS;
6767
}
6868

69-
private static class GenericTypeVisitor extends SimpleTypeVisitor6<DeclaredType, Void> {
69+
private class GenericTypeVisitor extends SimpleTypeVisitor6<DeclaredType, Void> {
7070
private final Types types;
7171
@Deprecated
7272
public GenericTypeVisitor(Types types) {

org.eclipse.jdt.compiler.apt.tests/processors/org/eclipse/jdt/compiler/apt/tests/processors/base/BaseProcessor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public abstract class BaseProcessor extends AbstractProcessor
2929

3030
/**
3131
* Report an error to the test case code
32+
* @param value
3233
*/
3334
public void reportError(String value) {
3435
// Debugging - don't report error
@@ -40,8 +41,7 @@ public void reportError(String value) {
4041
* Report success to the test case code
4142
*/
4243
public void reportSuccess() {
43-
if (System.getProperty(this.getClass().getName()) == null)
44-
System.setProperty(this.getClass().getName(), "succeeded");
44+
System.setProperty(this.getClass().getName(), "succeeded");
4545
}
4646

4747
public void reportFailure() {

org.eclipse.jdt.compiler.apt.tests/processors/org/eclipse/jdt/compiler/apt/tests/processors/base/XMLComparer.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2008, 2023 BEA Systems, Inc.
2+
* Copyright (c) 2008 BEA Systems, Inc.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -26,6 +26,7 @@
2626
import java.util.Map.Entry;
2727
import java.util.Set;
2828
import java.util.TreeMap;
29+
import javax.xml.parsers.DocumentBuilderFactory;
2930
import org.w3c.dom.Document;
3031
import org.w3c.dom.Element;
3132
import org.w3c.dom.NamedNodeMap;
@@ -62,7 +63,7 @@ public class XMLComparer implements IXMLNames {
6263
*
6364
* @since 3.4
6465
*/
65-
private static class DeclarationContents {
66+
private class DeclarationContents {
6667
Element annotations = null;
6768
Element superclass = null;
6869
Element interfaces = null;
@@ -139,6 +140,7 @@ public void write(int b) throws IOException {
139140
* this class to compare it to a known reference model. The models
140141
* should match.
141142
* @return true if the models matched, i.e., if the test passed
143+
* @throws Exception
142144
*/
143145
public static boolean test() throws Exception {
144146
final String XML_FRAMEWORK_TEST_MODEL =
@@ -161,7 +163,8 @@ public static boolean test() throws Exception {
161163
"</model>\n";
162164

163165
// create "actual" model
164-
Document actualModel = org.eclipse.core.internal.runtime.XmlProcessorFactory.createDocumentBuilderWithErrorOnDOCTYPE().newDocument();
166+
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
167+
Document actualModel = factory.newDocumentBuilder().newDocument();
165168
Element modelNode = actualModel.createElement(MODEL_TAG);
166169
// primary type
167170
Element typeNode = actualModel.createElement(TYPE_ELEMENT_TAG);
@@ -199,7 +202,7 @@ public static boolean test() throws Exception {
199202

200203
// load reference model
201204
InputSource source = new InputSource(new StringReader(XML_FRAMEWORK_TEST_MODEL));
202-
Document expectedModel = org.eclipse.core.internal.runtime.XmlProcessorFactory.createDocumentBuilderWithErrorOnDOCTYPE().parse(source);
205+
Document expectedModel = factory.newDocumentBuilder().parse(source);
203206

204207
// compare actual and reference
205208
ByteArrayOutputStream out = new ByteArrayOutputStream();

org.eclipse.jdt.compiler.apt.tests/processors/org/eclipse/jdt/compiler/apt/tests/processors/base/XMLConverter.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2008, 2023 BEA Systems, Inc.
2+
* Copyright (c) 2008 BEA Systems, Inc.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -28,6 +28,7 @@
2828
import javax.lang.model.element.VariableElement;
2929
import javax.lang.model.type.TypeMirror;
3030
import javax.lang.model.util.ElementScanner6;
31+
import javax.xml.parsers.DocumentBuilderFactory;
3132
import javax.xml.parsers.ParserConfigurationException;
3233
import javax.xml.transform.OutputKeys;
3334
import javax.xml.transform.Transformer;
@@ -62,7 +63,7 @@ public static String xmlToString(Document model) {
6263
StringWriter s = new StringWriter();
6364
DOMSource domSource = new DOMSource(model);
6465
StreamResult streamResult = new StreamResult(s);
65-
TransformerFactory tf = org.eclipse.core.internal.runtime.XmlProcessorFactory.createTransformerFactoryWithErrorOnDOCTYPE();
66+
TransformerFactory tf = TransformerFactory.newInstance();
6667
Transformer serializer;
6768
try {
6869
serializer = tf.newTransformer();
@@ -140,9 +141,11 @@ public static String xmlToCutAndPasteString(Document model, int indent, boolean
140141
* Recursively convert a collection of language elements (declarations) into an XML representation.
141142
* @param declarations the collection of language elements to convert
142143
* @return an XML document whose root node is named &lt;model&gt;.
144+
* @throws ParserConfigurationException
143145
*/
144146
public static Document convertModel(Iterable<? extends javax.lang.model.element.Element> declarations) throws ParserConfigurationException {
145-
Document model = org.eclipse.core.internal.runtime.XmlProcessorFactory.createDocumentBuilderWithErrorOnDOCTYPE().newDocument();
147+
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
148+
Document model = factory.newDocumentBuilder().newDocument();
146149
org.w3c.dom.Element modelNode = model.createElement(MODEL_TAG);
147150

148151
XMLConverter converter = new XMLConverter(model);
@@ -308,6 +311,8 @@ private void convertInterfaces(TypeElement e, Node target) {
308311

309312
/**
310313
* Create a node representing a class declaration's superclass
314+
* @param tmSuper
315+
* @param target
311316
*/
312317
private void convertSuperclass(TypeElement e, Node target) {
313318
TypeMirror tmSuper = e.getSuperclass();

0 commit comments

Comments
 (0)