Skip to content

JDK-8250768: javac should be adapted to changes in JEP 12 #703

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 59 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
0694db0
8250768: a prototype of updates for JEP 12.
lahodaj Sep 3, 2020
b9dbff5
Updates to the preview javadoc appearance.
lahodaj Sep 3, 2020
70286c0
Experimenting with UI for preview links.
lahodaj Sep 8, 2020
637b8c3
Experimenting with UI for preview links.
lahodaj Sep 9, 2020
7ffc68f
Merging master into JDK-8250768
lahodaj Sep 10, 2020
df6db2e
More experiments on Preview stuff in javadoc.
lahodaj Sep 10, 2020
d27c4dc
More updates to the javadoc Preview UI.
lahodaj Sep 15, 2020
00e2b94
Merge branch 'master' into JDK-8250768
lahodaj Sep 16, 2020
34f4355
Merge branch 'master' into JDK-8250768
lahodaj Sep 21, 2020
82f1c3a
More updateds to the preview javadoc appearance.
lahodaj Sep 23, 2020
976755d
Merging master into JDK-8250768
lahodaj Oct 2, 2020
d88fdd4
More updates to javadoc appearance
lahodaj Oct 5, 2020
26a2280
Merging master into JDK-8250768
lahodaj Oct 7, 2020
1b9a052
A post-merge fix.
lahodaj Oct 7, 2020
7cb5085
Cleaning up preview in javadoc.
lahodaj Oct 13, 2020
79b89dd
Fixing tests.
lahodaj Oct 14, 2020
1425c23
More cleanup.
lahodaj Oct 14, 2020
ca11180
Cleaning up whitespaces.
lahodaj Oct 14, 2020
6edf97a
Merge branch 'master' into JDK-8250768
lahodaj Oct 14, 2020
26dcc5b
Post-merge fix.
lahodaj Oct 14, 2020
6ba11d6
Updating build.
lahodaj Oct 14, 2020
994cc72
Adding forgotten files.
lahodaj Oct 15, 2020
ca78e89
Fixing tests.
lahodaj Oct 15, 2020
a99bfe3
Merging master into JDK-8250768
lahodaj Oct 15, 2020
42b5add
No, jdk.incubator.vector does not need jdk.internal package.
lahodaj Oct 15, 2020
2d179d6
There is not jdk.internal package anymore
lahodaj Oct 15, 2020
d23d55b
The Preview taglet is not needed anymore.
lahodaj Oct 16, 2020
c50d5ec
Various cleanup.
lahodaj Oct 16, 2020
efb37a9
Fixing tests.
lahodaj Oct 16, 2020
9ce4b0a
Reflecting review comments.
lahodaj Oct 19, 2020
30a9695
Merge branch 'master' into JDK-8250768
lahodaj Oct 20, 2020
2b625f5
Using unique sections for preview warning sections, as suggested.
lahodaj Oct 20, 2020
da4d41e
Fixing tests.
lahodaj Oct 20, 2020
49b720d
More fixing tests.
lahodaj Oct 20, 2020
be1d865
Merge branch 'JDK-8250768-dev' of https://github.com/lahodaj/jdk into…
lahodaj Oct 20, 2020
34169e0
Reflecting review comments.
lahodaj Oct 23, 2020
caa4fd3
Using a more correct way to get URLs.
lahodaj Oct 23, 2020
461e7d1
Removing unnecessary cast.
lahodaj Oct 23, 2020
deda85d
Merge branch 'master' into JDK-8250768
lahodaj Oct 26, 2020
e238784
Reflecting review comments.
lahodaj Oct 29, 2020
67e18e4
Merging master into JDK-8250768
lahodaj Oct 29, 2020
35f2a78
Finalizing removal of record preview hooks.
lahodaj Oct 29, 2020
cd4741e
Fixing tests.
lahodaj Oct 29, 2020
d76eb29
Updating tests after records are a final feature.
lahodaj Oct 29, 2020
a56fd33
Merging master into JDK-8250768.
lahodaj Nov 2, 2020
2e40390
Removing trailing whitespace.
lahodaj Nov 2, 2020
743f516
Reflecting review comments.
lahodaj Nov 4, 2020
afba66a
Merging master into JDK-8250768-dev4
lahodaj Nov 4, 2020
e4b0282
Cleanup - removing unnecessary code.
lahodaj Nov 4, 2020
b9e1739
Removing unnecessary property keys.
lahodaj Nov 5, 2020
3d55f90
Merging master into JDK-8250768
lahodaj Nov 5, 2020
370031f
Removing obsolette @PreviewFeature.
lahodaj Nov 5, 2020
097ae3c
Fixing typo.
lahodaj Nov 5, 2020
61264fe
Fixing navigator for the PREVIEW page.
lahodaj Nov 6, 2020
0c1c4d5
Merging recent master changes into JDK-8250768
lahodaj Dec 8, 2020
4ccb150
Merging master into JDK-8250768
lahodaj Jan 7, 2021
a8046dd
Fixing tests after a merge.
lahodaj Jan 7, 2021
56371c4
Updating copyright years.
lahodaj Jan 8, 2021
4f65495
Merging master into JDK-8250768
lahodaj Jan 8, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions make/CompileInterimLangtools.gmk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -49,8 +49,8 @@ TARGETS += $(patsubst %, $(BUILDTOOLS_OUTPUTDIR)/gensrc/%/module-info.java, \
$(INTERIM_LANGTOOLS_MODULES))

$(eval $(call SetupCopyFiles, COPY_PREVIEW_FEATURES, \
FILES := $(TOPDIR)/src/java.base/share/classes/jdk/internal/PreviewFeature.java, \
DEST := $(BUILDTOOLS_OUTPUTDIR)/gensrc/java.base.interim/jdk/internal/, \
FILES := $(TOPDIR)/src/java.base/share/classes/jdk/internal/javac/PreviewFeature.java, \
DEST := $(BUILDTOOLS_OUTPUTDIR)/gensrc/java.base.interim/jdk/internal/javac/, \
))

TARGETS += $(COPY_PREVIEW_FEATURES)
Expand Down Expand Up @@ -81,8 +81,8 @@ define SetupInterimModule
--module-path $(BUILDTOOLS_OUTPUTDIR)/interim_langtools_modules \
$$(INTERIM_LANGTOOLS_ADD_EXPORTS) \
--patch-module java.base=$(BUILDTOOLS_OUTPUTDIR)/gensrc/java.base.interim \
--add-exports java.base/jdk.internal=java.compiler.interim \
--add-exports java.base/jdk.internal=jdk.compiler.interim, \
--add-exports java.base/jdk.internal.javac=java.compiler.interim \
--add-exports java.base/jdk.internal.javac=jdk.compiler.interim, \
))

$1_DEPS_INTERIM := $$(addsuffix .interim, $$(filter \
Expand Down
1 change: 0 additions & 1 deletion make/Docs.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ JAVADOC_TAGS := \
-tag see \
-taglet build.tools.taglet.ExtLink \
-taglet build.tools.taglet.Incubating \
-taglet build.tools.taglet.Preview \
-tagletpath $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
$(CUSTOM_JAVADOC_TAGS) \
#
Expand Down
3 changes: 3 additions & 0 deletions make/autoconf/spec.gmk.in
Original file line number Diff line number Diff line change
Expand Up @@ -658,13 +658,16 @@ INTERIM_LANGTOOLS_ADD_EXPORTS := \
--add-exports java.base/jdk.internal.jmod=jdk.compiler.interim \
--add-exports java.base/jdk.internal.misc=jdk.compiler.interim \
--add-exports java.base/sun.invoke.util=jdk.compiler.interim \
--add-exports java.base/jdk.internal.javac=java.compiler.interim \
--add-exports java.base/jdk.internal.javac=jdk.compiler.interim \
#
INTERIM_LANGTOOLS_MODULES_COMMA := $(strip $(subst $(SPACE),$(COMMA),$(strip \
$(INTERIM_LANGTOOLS_MODULES))))
INTERIM_LANGTOOLS_ARGS := \
--limit-modules java.base,jdk.zipfs,$(INTERIM_LANGTOOLS_MODULES_COMMA) \
--add-modules $(INTERIM_LANGTOOLS_MODULES_COMMA) \
--module-path $(BUILDTOOLS_OUTPUTDIR)/interim_langtools_modules \
--patch-module java.base=$(BUILDTOOLS_OUTPUTDIR)/gensrc/java.base.interim \
$(INTERIM_LANGTOOLS_ADD_EXPORTS) \
#
JAVAC_MAIN_CLASS = -m jdk.compiler.interim/com.sun.tools.javac.Main
Expand Down
79 changes: 0 additions & 79 deletions make/jdk/src/classes/build/tools/taglet/Preview.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -1112,20 +1112,32 @@ private Annotation[][] createParameterAnnotations(List<CPInfo> constantPool, Lis

private Annotation createAnnotation(List<CPInfo> constantPool, AnnotationDescription desc) {
String annotationType = desc.annotationType;
Map<String, Object> values = desc.values;

if (PREVIEW_FEATURE_ANNOTATION.equals(annotationType)) {
if (PREVIEW_FEATURE_ANNOTATION_NEW.equals(annotationType)) {
//the non-public PreviewFeature annotation will not be available in ct.sym,
//replace with purely synthetic javac-internal annotation:
annotationType = PREVIEW_FEATURE_ANNOTATION_INTERNAL;
}

if (PREVIEW_FEATURE_ANNOTATION_OLD.equals(annotationType)) {
//the non-public PreviewFeature annotation will not be available in ct.sym,
//replace with purely synthetic javac-internal annotation:
annotationType = PREVIEW_FEATURE_ANNOTATION_INTERNAL;
values = new HashMap<>(values);
Boolean essentialAPI = (Boolean) values.remove("essentialAPI");
values.put("reflective", essentialAPI != null && !essentialAPI);
}

return new Annotation(null,
addString(constantPool, annotationType),
createElementPairs(constantPool, desc.values));
createElementPairs(constantPool, values));
}
//where:
private static final String PREVIEW_FEATURE_ANNOTATION =
private static final String PREVIEW_FEATURE_ANNOTATION_OLD =
"Ljdk/internal/PreviewFeature;";
private static final String PREVIEW_FEATURE_ANNOTATION_NEW =
"Ljdk/internal/javac/PreviewFeature;";
private static final String PREVIEW_FEATURE_ANNOTATION_INTERNAL =
"Ljdk/internal/PreviewFeature+Annotation;";

Expand Down
5 changes: 2 additions & 3 deletions make/modules/jdk.compiler/Gendata.gmk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -44,7 +44,7 @@ CT_MODULESOURCEPATH := $(call GetModuleSrcPath)
CT_DATA_DESCRIPTION += $(TOPDIR)/make/data/symbols/symbols

COMPILECREATESYMBOLS_ADD_EXPORTS := \
--add-exports java.base/jdk.internal=java.compiler.interim,jdk.compiler.interim \
--add-exports java.base/jdk.internal.javac=java.compiler.interim,jdk.compiler.interim \
--add-exports jdk.compiler.interim/com.sun.tools.javac.api=ALL-UNNAMED \
--add-exports jdk.compiler.interim/com.sun.tools.javac.code=ALL-UNNAMED \
--add-exports jdk.compiler.interim/com.sun.tools.javac.util=ALL-UNNAMED \
Expand All @@ -60,7 +60,6 @@ $(eval $(call SetupJavaCompilation, COMPILE_CREATE_SYMBOLS, \
DISABLED_WARNINGS := options, \
JAVAC_FLAGS := \
$(INTERIM_LANGTOOLS_ARGS) \
--patch-module java.base=$(BUILDTOOLS_OUTPUTDIR)/gensrc/java.base.interim \
$(COMPILECREATESYMBOLS_ADD_EXPORTS), \
))

Expand Down
3 changes: 1 addition & 2 deletions make/modules/jdk.javadoc/Gendata.gmk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -58,7 +58,6 @@ $(eval $(call SetupJavaCompilation, COMPILE_CREATE_SYMBOLS, \
DISABLED_WARNINGS := options, \
JAVAC_FLAGS := \
$(INTERIM_LANGTOOLS_ARGS) \
--patch-module java.base=$(BUILDTOOLS_OUTPUTDIR)/gensrc/java.base.interim \
$(COMPILECREATESYMBOLS_ADD_EXPORTS), \
))

Expand Down
20 changes: 3 additions & 17 deletions src/java.base/share/classes/java/lang/Class.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1994, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1994, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -4387,13 +4387,6 @@ public Optional<ClassDesc> describeConstable() {
public native boolean isHidden();

/**
* {@preview Associated with sealed classes, a preview feature of the Java language.
*
* This method is associated with <i>sealed classes</i>, a preview
* feature of the Java language. Preview features
* may be removed in a future release, or upgraded to permanent
* features of the Java language.}
*
* Returns an array containing {@code Class} objects representing the
* direct subinterfaces or subclasses permitted to extend or
* implement this class or interface if it is sealed. The order of such elements
Expand Down Expand Up @@ -4429,7 +4422,7 @@ public Optional<ClassDesc> describeConstable() {
* @jls 9.1 Interface Declarations
* @since 15
*/
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.SEALED_CLASSES, essentialAPI=false)
@jdk.internal.javac.PreviewFeature(feature=jdk.internal.javac.PreviewFeature.Feature.SEALED_CLASSES, reflective=true)
@CallerSensitive
public Class<?>[] getPermittedSubclasses() {
Class<?>[] subClasses;
Expand Down Expand Up @@ -4469,13 +4462,6 @@ private boolean isDirectSubType(Class<?> c) {
}

/**
* {@preview Associated with sealed classes, a preview feature of the Java language.
*
* This method is associated with <i>sealed classes</i>, a preview
* feature of the Java language. Preview features
* may be removed in a future release, or upgraded to permanent
* features of the Java language.}
*
* Returns {@code true} if and only if this {@code Class} object represents
* a sealed class or interface. If this {@code Class} object represents a
* primitive type, {@code void}, or an array type, this method returns
Expand All @@ -4489,7 +4475,7 @@ private boolean isDirectSubType(Class<?> c) {
* @jls 9.1 Interface Declarations
* @since 15
*/
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.SEALED_CLASSES, essentialAPI=false)
@jdk.internal.javac.PreviewFeature(feature=jdk.internal.javac.PreviewFeature.Feature.SEALED_CLASSES, reflective=true)
@SuppressWarnings("preview")
public boolean isSealed() {
if (isArray() || isPrimitive()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* questions.
*/

package jdk.internal;
package jdk.internal.javac;

import java.lang.annotation.*;

Expand Down Expand Up @@ -51,7 +51,7 @@
*/
public Feature feature();

public boolean essentialAPI() default false;
public boolean reflective() default false;

public enum Feature {
// 8242284:
Expand All @@ -68,6 +68,10 @@ public enum Feature {
// necessary for PreviewFeature in JDK 16 to declare the enum constant.
RECORDS,
SEALED_CLASSES,
/**
* A key for testing.
*/
TEST,
Comment on lines +71 to +74
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slightly weird

;
}
}
5 changes: 2 additions & 3 deletions src/java.base/share/classes/module-info.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -138,10 +138,9 @@
jdk.incubator.foreign;
exports com.sun.security.ntlm to
java.security.sasl;
exports jdk.internal to // for @HotSpotIntrinsicCandidate
exports jdk.internal.javac to
java.compiler,
jdk.compiler,
jdk.incubator.vector,
jdk.jshell;
exports jdk.internal.access to
java.desktop,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -66,33 +66,19 @@ public enum Modifier {
/** The modifier {@code static} */ STATIC,

/**
* {@preview Associated with sealed classes, a preview feature of the Java language.
*
* This enum constant is associated with <i>sealed classes</i>, a preview
* feature of the Java language. Preview features
* may be removed in a future release, or upgraded to permanent
* features of the Java language.}
*
* The modifier {@code sealed}
* @since 15
*/
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.SEALED_CLASSES,
essentialAPI=false)
@jdk.internal.javac.PreviewFeature(feature=jdk.internal.javac.PreviewFeature.Feature.SEALED_CLASSES,
reflective=true)
SEALED,

/**
* {@preview Associated with sealed classes, a preview feature of the Java language.
*
* This enum constant is associated with <i>sealed classes</i>, a preview
* feature of the Java language. Preview features
* may be removed in a future release, or upgraded to permanent
* features of the Java language.}
*
* The modifier {@code non-sealed}
* @since 15
*/
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.SEALED_CLASSES,
essentialAPI=false)
@jdk.internal.javac.PreviewFeature(feature=jdk.internal.javac.PreviewFeature.Feature.SEALED_CLASSES,
reflective=true)
NON_SEALED {
public String toString() {
return "non-sealed";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -199,12 +199,6 @@ default List<? extends RecordComponentElement> getRecordComponents() {
}

/**
* {@preview Associated with sealed classes, a preview feature of the Java language.
*
* This method is associated with <i>sealed classes</i>, a preview
* feature of the Java language. Preview features
* may be removed in a future release, or upgraded to permanent
* features of the Java language.}
* Returns the permitted classes of this class or interface
* element in declaration order.
*
Expand All @@ -215,8 +209,8 @@ default List<? extends RecordComponentElement> getRecordComponents() {
*
* @since 15
*/
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.SEALED_CLASSES,
essentialAPI=false)
@jdk.internal.javac.PreviewFeature(feature=jdk.internal.javac.PreviewFeature.Feature.SEALED_CLASSES,
reflective=true)
default List<? extends TypeMirror> getPermittedSubclasses() {
return List.of();
}
Expand Down
Loading