Skip to content

Commit 8f1d40b

Browse files
author
Pavel Rappo
committed
8321114: Rename "Unnamed Classes" to "Implicitly Declared Classes" better
Reviewed-by: jlaskey
1 parent ecd335d commit 8f1d40b

File tree

8 files changed

+19
-19
lines changed

8 files changed

+19
-19
lines changed

src/java.base/share/classes/java/lang/Class.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -190,21 +190,21 @@
190190
* a class or interface is hidden has no bearing on the characteristics
191191
* exposed by the methods of class {@code Class}.
192192
*
193-
* <h2><a id=implicitClasses>Implicit Classes</a></h2>
193+
* <h2><a id=implicitClasses>Implicitly Declared Classes</a></h2>
194194
*
195195
* Conventionally, a Java compiler, starting from a source file for an
196-
* implicit class, say {@code HelloWorld.java}, creates a
196+
* implicitly declared class, say {@code HelloWorld.java}, creates a
197197
* similarly-named {@code class} file, {@code HelloWorld.class}, where
198198
* the class stored in that {@code class} file is named {@code
199199
* "HelloWorld"}, matching the base names of the source and {@code
200200
* class} files.
201201
*
202-
* For the {@code Class} object of an implicit class {@code
202+
* For the {@code Class} object of an implicitly declared class {@code
203203
* HelloWorld}, the methods to get the {@linkplain #getName name} and
204204
* {@linkplain #getTypeName type name} return results
205205
* equal to {@code "HelloWorld"}. The {@linkplain #getSimpleName
206-
* simple name} of such an implicit class is {@code "HelloWorld"} and the
207-
* {@linkplain #getCanonicalName canonical name} is {@code "HelloWorld"}.
206+
* simple name} of such an implicitly declared class is {@code "HelloWorld"} and
207+
* the {@linkplain #getCanonicalName canonical name} is {@code "HelloWorld"}.
208208
*
209209
* @param <T> the type of the class modeled by this {@code Class}
210210
* object. For example, the type of {@code String.class} is {@code

src/java.base/share/classes/jdk/internal/javac/PreviewFeature.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public enum Feature {
7171
STRING_TEMPLATES,
7272
@JEP(number=445, title="Unnamed Classes and Instance Main Methods", status="Deprecated")
7373
UNNAMED_CLASSES,
74-
@JEP(number=463, title="Implicit Classes and Instance Main Methods", status="Preview")
74+
@JEP(number=463, title="Implicitly Declared Classes and Instance Main Methods", status="Preview")
7575
IMPLICIT_CLASSES,
7676
@JEP(number=446, title="Scoped Values", status="Preview")
7777
SCOPED_VALUES,

src/java.compiler/share/classes/javax/annotation/processing/Filer.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ public interface Filer {
181181
* classes, the name argument is used to provide the leading component of the
182182
* name used for the output file. For example {@code filer.createSourceFile("Foo")}
183183
* to create an implicitly declared class hosted in {@code Foo.java}. All
184-
* implicit classes must be in an unnamed package.
184+
* implicitly declared classes must be in an unnamed package.
185185
*
186186
* @apiNote To use a particular {@linkplain
187187
* java.nio.charset.Charset charset} to encode the contents of the
@@ -266,7 +266,7 @@ JavaFileObject createSourceFile(CharSequence name,
266266
* classes, the name argument is used to provide the leading component of the
267267
* name used for the output file. For example {@code filer.createSourceFile("Foo")}
268268
* to create an implicitly declared class hosted in {@code Foo.java}. All
269-
* implicit classes must be in an unnamed package.
269+
* implicitly declared classes must be in an unnamed package.
270270
*
271271
* @apiNote To avoid subsequent errors, the contents of the class
272272
* file should be compatible with the {@linkplain

src/jdk.compiler/share/classes/com/sun/tools/javac/code/Flags.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public static EnumSet<Flag> asFlagSet(long flags) {
123123
*/
124124
public static final int HASINIT = 1<<18;
125125

126-
/** Class is a implicit top level class.
126+
/** Class is an implicitly declared top level class.
127127
*/
128128
public static final int IMPLICIT_CLASS = 1<<19;
129129

src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1554,7 +1554,7 @@ public void setRecordComponents(List<RecordComponent> recordComponents) {
15541554
@DefinedBy(Api.LANGUAGE_MODEL)
15551555
public NestingKind getNestingKind() {
15561556
apiComplete();
1557-
if (owner.kind == PCK) // Handles implicit classes as well
1557+
if (owner.kind == PCK) // Handles implicitly declared classes as well
15581558
return NestingKind.TOP_LEVEL;
15591559
else if (name.isEmpty())
15601560
return NestingKind.ANONYMOUS;

src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -3982,11 +3982,11 @@ public JCTree.JCCompilationUnit parseCompilationUnit() {
39823982
defs.appendList(semiList.toList());
39833983
boolean isTopLevelMethodOrField = false;
39843984

3985-
// Do to a significant number of existing negative tests
3985+
// Due to a significant number of existing negative tests
39863986
// this code speculatively tests to see if a top level method
39873987
// or field can parse. If the method or field can parse then
39883988
// it is parsed. Otherwise, parsing continues as though
3989-
// implicit classes did not exist and error reporting
3989+
// implicitly declared classes did not exist and error reporting
39903990
// is the same as in the past.
39913991
if (Feature.IMPLICIT_CLASSES.allowedInSource(source) && !isDeclaration()) {
39923992
final JCModifiers finalMods = mods;
@@ -4014,7 +4014,7 @@ public JCTree.JCCompilationUnit parseCompilationUnit() {
40144014
firstTypeDecl = false;
40154015
}
40164016
}
4017-
List<JCTree> topLevelDefs = isImplicitClass ? constructImplictClass(defs.toList()) : defs.toList();
4017+
List<JCTree> topLevelDefs = isImplicitClass ? constructImplicitClass(defs.toList()) : defs.toList();
40184018
JCTree.JCCompilationUnit toplevel = F.at(firstToken.pos).TopLevel(topLevelDefs);
40194019
if (!consumedToplevelDoc)
40204020
attach(toplevel, firstToken.docComment());
@@ -4029,8 +4029,8 @@ public JCTree.JCCompilationUnit parseCompilationUnit() {
40294029
return toplevel;
40304030
}
40314031

4032-
// Restructure top level to be an implicit class.
4033-
private List<JCTree> constructImplictClass(List<JCTree> origDefs) {
4032+
// Restructure top level to be an implicitly declared class.
4033+
private List<JCTree> constructImplicitClass(List<JCTree> origDefs) {
40344034
ListBuffer<JCTree> topDefs = new ListBuffer<>();
40354035
ListBuffer<JCTree> defs = new ListBuffer<>();
40364036

src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties

+3-3
Original file line numberDiff line numberDiff line change
@@ -525,10 +525,10 @@ compiler.err.bad.file.name=\
525525
bad file name: {0}
526526

527527
compiler.err.implicit.class.should.not.have.package.declaration=\
528-
implicit class should not have package declaration
528+
implicitly declared class should not have package declaration
529529

530530
compiler.err.implicit.class.does.not.have.main.method=\
531-
implicit class does not have main method in the form of void main() or void main(String[] args)
531+
implicitly declared class does not have main method in the form of void main() or void main(String[] args)
532532

533533
# 0: name, 1: name
534534
compiler.err.same.binary.name=\
@@ -3219,7 +3219,7 @@ compiler.misc.feature.unconditional.patterns.in.instanceof=\
32193219
unconditional patterns in instanceof
32203220

32213221
compiler.misc.feature.implicit.classes=\
3222-
implicit classes
3222+
implicitly declared classes
32233223

32243224
compiler.misc.feature.super.init=\
32253225
statements before super()

test/langtools/tools/javac/processing/model/element/TestImplicitClass.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
import javax.tools.JavaFileObject;
5353

5454
/**
55-
* Test annotation processing representation of implicitly classes
55+
* Test annotation processing representation of implicitly declared classes
5656
* constructed from either a source file or a class file.
5757
*/
5858
@SuppressWarnings("preview")

0 commit comments

Comments
 (0)