Skip to content

Commit d29700c

Browse files
lahodajStuart Marks
andcommitted
8344706: Implement JEP 512: Compact Source Files and Instance Main Methods
Co-authored-by: Stuart Marks <[email protected]> Reviewed-by: liach, cstein, vromero, naoto
1 parent bd7c778 commit d29700c

File tree

59 files changed

+476
-725
lines changed

Some content is hidden

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

59 files changed

+476
-725
lines changed

src/java.base/share/classes/java/io/Console.java

Lines changed: 1 addition & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -31,7 +31,6 @@
3131
import jdk.internal.access.SharedSecrets;
3232
import jdk.internal.io.JdkConsoleImpl;
3333
import jdk.internal.io.JdkConsoleProvider;
34-
import jdk.internal.javac.PreviewFeature;
3534
import sun.nio.cs.UTF_8;
3635

3736
/**
@@ -148,100 +147,6 @@ public Reader reader() {
148147
throw newUnsupportedOperationException();
149148
}
150149

151-
/**
152-
* Writes a string representation of the specified object to this console's
153-
* output stream, terminates the line using {@link System#lineSeparator()}
154-
* and then flushes the console.
155-
*
156-
* <p> The string representation of the specified object is obtained as if
157-
* by calling {@link String#valueOf(Object)}.
158-
*
159-
* @param obj
160-
* An object whose string representation is to be written,
161-
* may be {@code null}.
162-
*
163-
* @return This console
164-
*
165-
* @since 23
166-
*/
167-
@PreviewFeature(feature = PreviewFeature.Feature.IMPLICIT_CLASSES)
168-
public Console println(Object obj) {
169-
throw newUnsupportedOperationException();
170-
}
171-
172-
/**
173-
* Terminates the current line in this console's output stream using
174-
* {@link System#lineSeparator()} and then flushes the console.
175-
*
176-
* @return This console
177-
*
178-
* @since 24
179-
*/
180-
@PreviewFeature(feature = PreviewFeature.Feature.IMPLICIT_CLASSES)
181-
public Console println() {
182-
return println("");
183-
}
184-
185-
/**
186-
* Writes a string representation of the specified object to this console's
187-
* output stream and then flushes the console.
188-
*
189-
* <p> The string representation of the specified object is obtained as if
190-
* by calling {@link String#valueOf(Object)}.
191-
*
192-
* @param obj
193-
* An object whose string representation is to be written,
194-
* may be {@code null}.
195-
*
196-
* @return This console
197-
*
198-
* @since 23
199-
*/
200-
@PreviewFeature(feature = PreviewFeature.Feature.IMPLICIT_CLASSES)
201-
public Console print(Object obj) {
202-
throw newUnsupportedOperationException();
203-
}
204-
205-
/**
206-
* Writes a prompt as if by calling {@code print}, then reads a single line
207-
* of text from this console.
208-
*
209-
* @param prompt
210-
* A prompt string, may be {@code null}.
211-
*
212-
* @throws IOError
213-
* If an I/O error occurs.
214-
*
215-
* @return A string containing the line read from the console, not
216-
* including any line-termination characters, or {@code null}
217-
* if an end of stream has been reached without having read
218-
* any characters.
219-
*
220-
* @since 23
221-
*/
222-
@PreviewFeature(feature = PreviewFeature.Feature.IMPLICIT_CLASSES)
223-
public String readln(String prompt) {
224-
throw newUnsupportedOperationException();
225-
}
226-
227-
/**
228-
* Reads a single line of text from this console.
229-
*
230-
* @throws IOError
231-
* If an I/O error occurs.
232-
*
233-
* @return A string containing the line read from the console, not
234-
* including any line-termination characters, or {@code null}
235-
* if an end of stream has been reached without having read
236-
* any characters.
237-
*
238-
* @since 24
239-
*/
240-
@PreviewFeature(feature = PreviewFeature.Feature.IMPLICIT_CLASSES)
241-
public String readln() {
242-
throw newUnsupportedOperationException();
243-
}
244-
245150
/**
246151
* Writes a formatted string to this console's output stream using
247152
* the specified format string and arguments with the

src/java.base/share/classes/java/io/IO.java

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

src/java.base/share/classes/java/io/ProxyingConsole.java

Lines changed: 1 addition & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -81,54 +81,6 @@ public Reader reader() {
8181
return reader;
8282
}
8383

84-
/**
85-
* {@inheritDoc}
86-
*/
87-
@Override
88-
public Console println(Object obj) {
89-
synchronized (writeLock) {
90-
delegate.println(obj);
91-
}
92-
return this;
93-
}
94-
95-
/**
96-
* {@inheritDoc}
97-
*/
98-
@Override
99-
public Console print(Object obj) {
100-
synchronized (writeLock) {
101-
delegate.print(obj);
102-
}
103-
return this;
104-
}
105-
106-
/**
107-
* {@inheritDoc}
108-
*
109-
* @throws IOError {@inheritDoc}
110-
*/
111-
@Override
112-
public String readln(String prompt) {
113-
synchronized (writeLock) {
114-
synchronized (readLock) {
115-
return delegate.readln(prompt);
116-
}
117-
}
118-
}
119-
120-
/**
121-
* {@inheritDoc}
122-
*
123-
* @throws IOError {@inheritDoc}
124-
*/
125-
@Override
126-
public String readln() {
127-
synchronized (readLock) {
128-
return delegate.readln();
129-
}
130-
}
131-
13284
/**
13385
* {@inheritDoc}
13486
*/

0 commit comments

Comments
 (0)