Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[NETBEANS-2917]: Support for yield in Switch-Expression for JDK-13 (#…
…1409) * Adding support for yield. * Adding forgotten test API. * [NETBEANS-2917]: AutoCompletion of Yield keyword inside Switch Expression for JDK-13 * [NETBEANS-2917]: Corrected formatting for Switch Expression using yield with value * [NETBEANS-2917]: Added autocomplete for Switch-Expr Yield keyword inside Block * [NETBEANS-2917]: Modified Test-Cases for supporting Yield with value inside Switch Expression * [NETBEANS-2917]: Refactored code for Yield Support in Switch Expression * [NETBEANS-2917]:Syncing golden file with master
- Loading branch information
Arunava Sinha
committed
Aug 27, 2019
1 parent
8f82dfc
commit 3ddcdc4
Showing
26 changed files
with
361 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...ans/modules/java/completion/JavaCompletionTaskTest/1.8/SwitchExprYieldAutoCompletion.pass
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
yield |
1 change: 1 addition & 0 deletions
1
...eans/modules/java/completion/JavaCompletionTaskTest/10/SwitchExprYieldAutoCompletion.pass
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
yield |
1 change: 1 addition & 0 deletions
1
...eans/modules/java/completion/JavaCompletionTaskTest/11/SwitchExprYieldAutoCompletion.pass
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
yield |
1 change: 1 addition & 0 deletions
1
...eans/modules/java/completion/JavaCompletionTaskTest/12/SwitchExprYieldAutoCompletion.pass
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
yield |
1 change: 1 addition & 0 deletions
1
...eans/modules/java/completion/JavaCompletionTaskTest/13/SwitchExprYieldAutoCompletion.pass
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
yield |
1 change: 1 addition & 0 deletions
1
...s/modules/java/completion/JavaCompletionTaskTest/13/ruleSwitchAutoCompleteCaseValues.pass
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
case |
1 change: 1 addition & 0 deletions
1
.../netbeans/modules/java/completion/JavaCompletionTaskTest/13/ruleSwitchEnumCaseValues.pass
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
public static final colors BLUE |
3 changes: 3 additions & 0 deletions
3
.../org/netbeans/modules/java/completion/JavaCompletionTaskTest/13/switchEnumCaseValues.pass
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
public static final colors BLUE | ||
public static final colors GREEN | ||
public static final colors RED |
2 changes: 2 additions & 0 deletions
2
...org/netbeans/modules/java/completion/JavaCompletionTaskTest/13/switchEnumCaseValues2.pass
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
public static final colors BLUE | ||
public static final colors GREEN |
2 changes: 2 additions & 0 deletions
2
.../netbeans/modules/java/completion/JavaCompletionTaskTest/13/switchExprEnumCaseValues.pass
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
public static final colors BLUE | ||
public static final colors GREEN |
35 changes: 35 additions & 0 deletions
35
...test/unit/data/org/netbeans/modules/java/completion/data/SwitchExprForYieldWithValue.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
package test; | ||
|
||
public class Test { | ||
|
||
enum colors {RED, GREEN, BLUE} | ||
|
||
public void op(int a) { | ||
colors color = colors.RED; | ||
a = switch (color) { | ||
case RED: | ||
a=20; | ||
|
||
|
||
} | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
...est/unit/data/org/netbeans/modules/java/completion/data/SwitchExprForYieldWithValue2.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
package test; | ||
|
||
public class Test { | ||
|
||
enum colors {RED, GREEN, BLUE} | ||
|
||
public void op(int a) { | ||
colors color = colors.RED; | ||
a = switch (color) { | ||
case RED-> { | ||
a = 20; | ||
} | ||
|
||
|
||
}; | ||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
...test/unit/src/org/netbeans/modules/java/completion/JavaCompletionTask113FeaturesTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package org.netbeans.modules.java.completion; | ||
|
||
import javax.lang.model.SourceVersion; | ||
import org.netbeans.junit.NbTestSuite; | ||
|
||
/** | ||
* | ||
* @author arusinha | ||
*/ | ||
public class JavaCompletionTask113FeaturesTest extends CompletionTestBase { | ||
|
||
public JavaCompletionTask113FeaturesTest(String testName) { | ||
super(testName); | ||
} | ||
|
||
public static NbTestSuite suite() { | ||
NbTestSuite suite = new NbTestSuite(); | ||
try { | ||
SourceVersion.valueOf("RELEASE_13"); //NOI18N | ||
suite.addTestSuite(JavaCompletionTask113FeaturesTest.class); | ||
} catch (IllegalArgumentException ex) { | ||
//OK, no RELEASE_13, skip tests | ||
suite.addTest(new JavaCompletionTask113FeaturesTest("noop")); //NOI18N | ||
} | ||
return suite; | ||
} | ||
|
||
public void testSwitchExprAutoCompleteYieldValue() throws Exception { | ||
performTest("SwitchExprForYieldWithValue", 1019, "yi", "SwitchExprYieldAutoCompletion.pass"); | ||
} | ||
|
||
public void testSwitchExprAutoCompleteYieldValue2() throws Exception { | ||
performTest("SwitchExprForYieldWithValue2", 1023, "yi", "SwitchExprYieldAutoCompletion.pass"); | ||
} | ||
|
||
public void noop() { | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.