Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
NetBeans
Apache NetBeans
Commits
8388dd19
Unverified
Commit
8388dd19
authored
Oct 26, 2021
by
Neil C Smith
Committed by
GitHub
Oct 26, 2021
Browse files
Merge pull request #3267 from apache/delivery
Merge delivery to release126 for NB12.6-rc1
parents
d5a9964a
33d95c55
Changes
8
Hide whitespace changes
Inline
Side-by-side
java/java.completion/src/org/netbeans/modules/java/completion/JavaCompletionTask.java
View file @
8388dd19
...
...
@@ -4664,7 +4664,7 @@ public final class JavaCompletionTask<T> extends BaseTask {
&&
env
.
getController
().
getTreeUtilities
().
getPathElementOfKind
(
Tree
.
Kind
.
INTERFACE
,
env
.
getPath
())
!=
null
)
{
results
.
add
(
itemFactory
.
createKeywordItem
(
DEFAULT_KEYWORD
,
SPACE
,
anchorOffset
,
false
));
}
if
(
isRecordSupported
(
env
))
{
if
(
isRecordSupported
(
env
)
&&
Utilities
.
startsWith
(
RECORD_KEYWORD
,
prefix
)
)
{
results
.
add
(
itemFactory
.
createKeywordItem
(
RECORD_KEYWORD
,
SPACE
,
anchorOffset
,
false
));
}
addPrimitiveTypeKeywords
(
env
);
...
...
@@ -4682,7 +4682,7 @@ public final class JavaCompletionTask<T> extends BaseTask {
results
.
add
(
itemFactory
.
createKeywordItem
(
kw
,
SPACE
,
anchorOffset
,
false
));
}
}
if
(
isRecordSupported
(
env
))
{
if
(
isRecordSupported
(
env
)
&&
Utilities
.
startsWith
(
RECORD_KEYWORD
,
prefix
)
)
{
results
.
add
(
itemFactory
.
createKeywordItem
(
RECORD_KEYWORD
,
SPACE
,
anchorOffset
,
false
));
}
if
(
Utilities
.
startsWith
(
RETURN_KEYWORD
,
prefix
))
{
...
...
java/java.completion/test/unit/src/org/netbeans/modules/java/completion/JavaCompletionTask114FeaturesTest.java
View file @
8388dd19
...
...
@@ -33,7 +33,7 @@ import org.openide.util.lookup.ServiceProvider;
*/
public
class
JavaCompletionTask114FeaturesTest
extends
CompletionTestBase
{
private
static
String
SOURCE_LEVEL
=
"14"
;
//NOI18N
private
static
final
String
SOURCE_LEVEL
=
"14"
;
//NOI18N
public
JavaCompletionTask114FeaturesTest
(
String
testName
)
{
super
(
testName
);
...
...
@@ -78,9 +78,21 @@ public class JavaCompletionTask114FeaturesTest extends CompletionTestBase {
performTest
(
"Records"
,
999
,
null
,
"override.pass"
,
SOURCE_LEVEL
);
}
public
void
testRecordKeywordInside
Class
()
throws
Exception
{
public
void
testRecordKeywordInside
Method
()
throws
Exception
{
performTest
(
"Records"
,
1014
,
"rec"
,
"record.pass"
,
SOURCE_LEVEL
);
}
}
public
void
testRecordKeywordInsideClass
()
throws
Exception
{
performTest
(
"Records"
,
844
,
"rec"
,
"record.pass"
,
SOURCE_LEVEL
);
}
public
void
testRecordKeywordInsideMethodIfPrefixDoesntMatch
()
throws
Exception
{
performTest
(
"Records"
,
1014
,
"someprefix"
,
"empty.pass"
,
SOURCE_LEVEL
);
}
public
void
testRecordKeywordInsideClassIfPrefixDoesntMatch
()
throws
Exception
{
performTest
(
"Records"
,
844
,
"someprefix"
,
"empty.pass"
,
SOURCE_LEVEL
);
}
public
void
testVariableNameSuggestion
()
throws
Exception
{
TestCompilerOptionsQueryImplementation
.
EXTRA_OPTIONS
.
add
(
"--enable-preview"
);
...
...
java/java.hints/src/org/netbeans/modules/java/hints/jdk/ConvertTextBlockToString.java
View file @
8388dd19
...
...
@@ -28,6 +28,7 @@ import org.netbeans.api.java.source.CompilationInfo;
import
org.netbeans.api.lexer.TokenSequence
;
import
org.netbeans.spi.editor.hints.ErrorDescription
;
import
org.netbeans.spi.editor.hints.Fix
;
import
org.netbeans.spi.editor.hints.Severity
;
import
org.netbeans.spi.java.hints.ErrorDescriptionFactory
;
import
org.netbeans.spi.java.hints.Hint
;
import
org.netbeans.spi.java.hints.HintContext
;
...
...
@@ -35,15 +36,15 @@ import org.netbeans.spi.java.hints.JavaFix;
import
org.netbeans.spi.java.hints.TriggerTreeKind
;
import
org.openide.util.NbBundle.Messages
;
@Hint
(
displayName
=
"#DN_ConvertTextBlockToString"
,
description
=
"#DESC_ConvertTextBlockToString"
,
category
=
"
general"
,
minSourceVersion
=
"13"
)
@Hint
(
displayName
=
"#DN_ConvertTextBlockToString"
,
description
=
"#DESC_ConvertTextBlockToString"
,
category
=
"
rules15"
,
severity
=
Severity
.
HINT
)
@Messages
({
"DN_ConvertTextBlockToString=Convert Text block to String"
,
"DESC_ConvertTextBlockToString=
Text Block may not be supported in older versions of java older then 13
"
"DESC_ConvertTextBlockToString=
Converts java 15 Text Blocks back to regular Strings.
"
})
public
class
ConvertTextBlockToString
{
@TriggerTreeKind
(
Tree
.
Kind
.
STRING_LITERAL
)
@Messages
(
"ERR_ConvertTextBlockToString=Text block
may not be supported
"
)
//NOI18N
@Messages
(
"ERR_ConvertTextBlockToString=Text block
can be converted to String
"
)
//NOI18N
public
static
ErrorDescription
computeWarning
(
HintContext
ctx
)
{
TokenSequence
<?>
ts
=
ctx
.
getInfo
().
getTokenHierarchy
().
tokenSequence
();
if
(
ts
==
null
)
{
...
...
@@ -89,8 +90,8 @@ public class ConvertTextBlockToString {
protected
void
performRewrite
(
TransformationContext
ctx
)
{
ExpressionTree
ext
=
ctx
.
getWorkingCopy
().
getTreeMaker
().
Literal
(
orignalStringArr
[
orignalStringArr
.
length
-
1
]);
if
(
orignalStringArr
.
length
>
1
)
{
ext
=
ctx
.
getWorkingCopy
().
getTreeMaker
().
Binary
(
Tree
.
Kind
.
PLUS
,
buildTree
(
orignalStringArr
,
orignalStringArr
.
length
-
2
,
ctx
),
(
ExpressionTree
)
ext
);
if
(
orignalStringArr
[
orignalStringArr
.
length
-
1
].
equals
(
""
))
{
ext
=
ctx
.
getWorkingCopy
().
getTreeMaker
().
Binary
(
Tree
.
Kind
.
PLUS
,
buildTree
(
orignalStringArr
,
orignalStringArr
.
length
-
2
,
ctx
),
ext
);
if
(
orignalStringArr
[
orignalStringArr
.
length
-
1
].
isEmpty
(
))
{
ext
=
(((
BinaryTree
)
ext
).
getLeftOperand
());
}
}
...
...
java/java.hints/test/unit/src/org/netbeans/modules/java/hints/jdk/ConvertTextBlockToStringTest.java
View file @
8388dd19
...
...
@@ -55,7 +55,7 @@ public class ConvertTextBlockToStringTest {
.
sourceLevel
(
SourceVersion
.
latest
().
name
())
.
options
(
"--enable-preview"
)
.
run
(
ConvertTextBlockToString
.
class
)
.
findWarning
(
"3:18-3:21:
verifier
:"
+
Bundle
.
ERR_ConvertTextBlockToString
())
.
findWarning
(
"3:18-3:21:
hint
:"
+
Bundle
.
ERR_ConvertTextBlockToString
())
.
applyFix
()
.
assertCompilable
()
.
assertOutput
(
"package helloworld;\n"
...
...
@@ -85,7 +85,7 @@ public class ConvertTextBlockToStringTest {
.
sourceLevel
(
SourceVersion
.
latest
().
name
())
.
options
(
"--enable-preview"
)
.
run
(
ConvertTextBlockToString
.
class
)
.
findWarning
(
"3:18-3:21:
verifier
:"
+
Bundle
.
ERR_ConvertTextBlockToString
())
.
findWarning
(
"3:18-3:21:
hint
:"
+
Bundle
.
ERR_ConvertTextBlockToString
())
.
applyFix
()
.
assertCompilable
()
.
assertOutput
(
"package helloworld;\n"
...
...
@@ -121,7 +121,7 @@ public class ConvertTextBlockToStringTest {
.
sourceLevel
(
SourceVersion
.
latest
().
name
())
.
options
(
"--enable-preview"
)
.
run
(
ConvertTextBlockToString
.
class
)
.
findWarning
(
"3:18-3:21:
verifier
:"
+
Bundle
.
ERR_ConvertTextBlockToString
())
.
findWarning
(
"3:18-3:21:
hint
:"
+
Bundle
.
ERR_ConvertTextBlockToString
())
.
applyFix
()
.
assertCompilable
()
.
assertOutput
(
"package helloworld;\n"
...
...
@@ -156,7 +156,7 @@ public class ConvertTextBlockToStringTest {
.
sourceLevel
(
SourceVersion
.
latest
().
name
())
.
options
(
"--enable-preview"
)
.
run
(
ConvertTextBlockToString
.
class
)
.
findWarning
(
"3:18-3:21:
verifier
:"
+
Bundle
.
ERR_ConvertTextBlockToString
())
.
findWarning
(
"3:18-3:21:
hint
:"
+
Bundle
.
ERR_ConvertTextBlockToString
())
.
applyFix
()
.
assertCompilable
()
.
assertOutput
(
"package helloworld;\n"
...
...
@@ -197,7 +197,7 @@ public class ConvertTextBlockToStringTest {
.
sourceLevel
(
SourceVersion
.
latest
().
name
())
.
options
(
"--enable-preview"
)
.
run
(
ConvertTextBlockToString
.
class
)
.
findWarning
(
"3:18-3:21:
verifier
:"
+
Bundle
.
ERR_ConvertTextBlockToString
())
.
findWarning
(
"3:18-3:21:
hint
:"
+
Bundle
.
ERR_ConvertTextBlockToString
())
.
applyFix
()
.
assertCompilable
()
.
assertOutput
(
"package helloworld;\n"
...
...
@@ -228,7 +228,7 @@ public class ConvertTextBlockToStringTest {
.
sourceLevel
(
SourceVersion
.
latest
().
name
())
.
options
(
"--enable-preview"
)
.
run
(
ConvertTextBlockToString
.
class
)
.
findWarning
(
"3:18-3:21:
verifier
:"
+
Bundle
.
ERR_ConvertTextBlockToString
())
.
findWarning
(
"3:18-3:21:
hint
:"
+
Bundle
.
ERR_ConvertTextBlockToString
())
.
applyFix
()
.
assertCompilable
()
.
assertOutput
(
"package helloworld;\n"
...
...
@@ -260,7 +260,7 @@ public class ConvertTextBlockToStringTest {
.
sourceLevel
(
SourceVersion
.
latest
().
name
())
.
options
(
"--enable-preview"
)
.
run
(
ConvertTextBlockToString
.
class
)
.
findWarning
(
"3:18-3:21:
verifier
:"
+
Bundle
.
ERR_ConvertTextBlockToString
())
.
findWarning
(
"3:18-3:21:
hint
:"
+
Bundle
.
ERR_ConvertTextBlockToString
())
.
applyFix
()
.
assertCompilable
()
.
assertOutput
(
"package helloworld;\n"
...
...
@@ -290,7 +290,7 @@ public class ConvertTextBlockToStringTest {
.
sourceLevel
(
SourceVersion
.
latest
().
name
())
.
options
(
"--enable-preview"
)
.
run
(
ConvertTextBlockToString
.
class
)
.
findWarning
(
"3:18-3:21:
verifier
:"
+
Bundle
.
ERR_ConvertTextBlockToString
())
.
findWarning
(
"3:18-3:21:
hint
:"
+
Bundle
.
ERR_ConvertTextBlockToString
())
.
applyFix
()
.
assertCompilable
()
.
assertOutput
(
"package helloworld;\n"
...
...
@@ -321,7 +321,7 @@ public class ConvertTextBlockToStringTest {
.
sourceLevel
(
SourceVersion
.
latest
().
name
())
.
options
(
"--enable-preview"
)
.
run
(
ConvertTextBlockToString
.
class
)
.
findWarning
(
"3:18-3:21:
verifier
:"
+
Bundle
.
ERR_ConvertTextBlockToString
())
.
findWarning
(
"3:18-3:21:
hint
:"
+
Bundle
.
ERR_ConvertTextBlockToString
())
.
applyFix
()
.
assertCompilable
()
.
assertOutput
(
"package helloworld;\n"
...
...
@@ -356,7 +356,7 @@ public class ConvertTextBlockToStringTest {
.
sourceLevel
(
SourceVersion
.
latest
().
name
())
.
options
(
"--enable-preview"
)
.
run
(
ConvertTextBlockToString
.
class
)
.
findWarning
(
"3:18-3:21:
verifier
:"
+
Bundle
.
ERR_ConvertTextBlockToString
())
.
findWarning
(
"3:18-3:21:
hint
:"
+
Bundle
.
ERR_ConvertTextBlockToString
())
.
applyFix
()
.
assertCompilable
()
.
assertOutput
(
"package helloworld;\n"
...
...
@@ -387,7 +387,7 @@ public class ConvertTextBlockToStringTest {
.
sourceLevel
(
SourceVersion
.
latest
().
name
())
.
options
(
"--enable-preview"
)
.
run
(
ConvertTextBlockToString
.
class
)
.
findWarning
(
"4:27-4:30:
verifier
:"
+
Bundle
.
ERR_ConvertTextBlockToString
())
.
findWarning
(
"4:27-4:30:
hint
:"
+
Bundle
.
ERR_ConvertTextBlockToString
())
.
applyFix
()
.
assertCompilable
()
.
assertOutput
(
"package test;\n"
...
...
@@ -419,7 +419,7 @@ public class ConvertTextBlockToStringTest {
.
sourceLevel
(
SourceVersion
.
latest
().
name
())
.
options
(
"--enable-preview"
)
.
run
(
ConvertTextBlockToString
.
class
)
.
findWarning
(
"2:27-2:30:
verifier
:"
+
Bundle
.
ERR_ConvertTextBlockToString
())
.
findWarning
(
"2:27-2:30:
hint
:"
+
Bundle
.
ERR_ConvertTextBlockToString
())
.
applyFix
()
.
assertCompilable
()
.
assertOutput
(
"class myClass{\n"
...
...
java/java.lsp.server/vscode/src/extension.ts
View file @
8388dd19
...
...
@@ -42,6 +42,7 @@ import * as launcher from './nbcode';
import
{
NbTestAdapter
}
from
'
./testAdapter
'
;
import
{
asRanges
,
StatusMessageRequest
,
ShowStatusMessageParams
,
QuickPickRequest
,
InputBoxRequest
,
TestProgressNotification
,
DebugConnector
,
TextEditorDecorationCreateRequest
,
TextEditorDecorationSetNotification
,
TextEditorDecorationDisposeNotification
,
SetTextEditorDecorationParams
}
from
'
./protocol
'
;
import
*
as
launchConfigurations
from
'
./launchConfigurations
'
;
...
...
@@ -603,6 +604,7 @@ function doActivateWithJDK(specifiedJDK: string | null, context: ExtensionContex
}
});
let
decorations
=
new
Map
<
string
,
TextEditorDecorationType
>
();
let
decorationParamsByUri
=
new
Map
<
vscode
.
Uri
,
SetTextEditorDecorationParams
>
();
c
.
onRequest
(
TextEditorDecorationCreateRequest
.
type
,
param
=>
{
let
decorationType
=
vscode
.
window
.
createTextEditorDecorationType
(
param
);
decorations
.
set
(
decorationType
.
key
,
decorationType
);
...
...
@@ -616,13 +618,32 @@ function doActivateWithJDK(specifiedJDK: string | null, context: ExtensionContex
);
if
(
editorsWithUri
.
length
>
0
)
{
editorsWithUri
[
0
].
setDecorations
(
decorationType
,
asRanges
(
param
.
ranges
));
decorationParamsByUri
.
set
(
editorsWithUri
[
0
].
document
.
uri
,
param
);
}
}
});
let
disposableListener
=
vscode
.
window
.
onDidChangeVisibleTextEditors
(
editors
=>
{
editors
.
forEach
(
editor
=>
{
let
decorationParams
=
decorationParamsByUri
.
get
(
editor
.
document
.
uri
);
if
(
decorationParams
)
{
let
decorationType
=
decorations
.
get
(
decorationParams
.
key
);
if
(
decorationType
)
{
editor
.
setDecorations
(
decorationType
,
asRanges
(
decorationParams
.
ranges
));
}
}
});
});
context
.
subscriptions
.
push
(
disposableListener
);
c
.
onNotification
(
TextEditorDecorationDisposeNotification
.
type
,
param
=>
{
let
decorationType
=
decorations
.
get
(
param
);
if
(
decorationType
)
{
decorations
.
delete
(
param
);
decorationType
.
dispose
();
decorationParamsByUri
.
forEach
((
value
,
key
,
map
)
=>
{
if
(
value
.
key
==
param
)
{
map
.
delete
(
key
);
}
});
}
});
handleLog
(
log
,
'
Language Client: Ready
'
);
...
...
nbbuild/installer/components/products/nb-javaee/nbproject/project.properties
View file @
8388dd19
...
...
@@ -43,7 +43,7 @@ javac.classpath=\
# Space-separated list of extra javac options
javac.compilerargs
=
javac.deprecation
=
false
javac.source
=
1.
5
javac.source
=
1.
6
javac.target
=
1.8
javac.test.classpath
=
\
${javac.classpath}:
\
...
...
nbbuild/installer/components/products/nb-php/nbproject/project.properties
View file @
8388dd19
...
...
@@ -42,7 +42,7 @@ javac.classpath=\
# Space-separated list of extra javac options
javac.compilerargs
=
javac.deprecation
=
false
javac.source
=
1.
5
javac.source
=
1.
6
javac.target
=
1.8
javac.test.classpath
=
\
${javac.classpath}:
\
...
...
nbi/infra/build/.common/common.properties
View file @
8388dd19
...
...
@@ -100,7 +100,7 @@ nb.target.build=jar
# global script
# * ${nb.custom.tasks.cls} - points the netbeans project's build script to the
# location of the built custom tasks
nb.platform.home
=
-Dplatforms.JDK_1.5.home=${java.home}
/..
nb.platform.home
=
-Dplatforms.JDK_1.5.home=${java.home}
nb.platform.home.macos
=
-Dplatforms.JDK_1.5.home=${java.home}
nb.ignore.native
=
-Dignore.native=true
nb.no.dependencies
=
-Dno.dependencies=true
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment