mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 03:13:40 +07:00
more java tests moved to community
This commit is contained in:
+16
@@ -0,0 +1,16 @@
|
||||
// "Access static 'AClass.fff' via class 'AClass' reference" "true"
|
||||
|
||||
class AClass
|
||||
{
|
||||
AClass getA() {
|
||||
return null;
|
||||
}
|
||||
static int fff;
|
||||
}
|
||||
|
||||
class acc {
|
||||
int f() {
|
||||
AClass a = null;
|
||||
return <caret>AClass.fff;
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// "Access static 'AClass.fff' via class 'AClass' reference" "true"
|
||||
|
||||
class AClass
|
||||
{
|
||||
AClass getA() {
|
||||
int i = <caret>fff;
|
||||
return null;
|
||||
|
||||
}
|
||||
static int fff;
|
||||
}
|
||||
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// "Access static 'AClass.getA()' via class 'AClass' reference" "true"
|
||||
|
||||
class AClass
|
||||
{
|
||||
static AClass getA() {
|
||||
return null;
|
||||
}
|
||||
static int fff;
|
||||
}
|
||||
|
||||
class acc {
|
||||
int f() {
|
||||
AClass a = null;
|
||||
<caret>AClass.getA();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Access static 'AClass.stat' via class 'AClass' reference" "true"
|
||||
|
||||
class AClass {
|
||||
static boolean stat;
|
||||
void foo (boolean stat) {
|
||||
AClass.stat<caret> = stat;
|
||||
}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// "Access static 'AClass.R.rr' via class 'R' reference" "true"
|
||||
|
||||
class AClass
|
||||
{
|
||||
public static class R {
|
||||
static int rr = 0;
|
||||
}
|
||||
public R getR() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
class ss {
|
||||
void f(AClass d){
|
||||
int i = <caret>AClass.R.rr;
|
||||
}
|
||||
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// "Access static 'AClass.fff' via class 'AClass' reference" "true"
|
||||
|
||||
class AClass
|
||||
{
|
||||
AClass getA() {
|
||||
return null;
|
||||
}
|
||||
static int fff;
|
||||
}
|
||||
|
||||
class acc {
|
||||
int f() {
|
||||
AClass a = null;
|
||||
return <caret>a.getA().fff;
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// "Access static 'AClass.fff' via class 'AClass' reference" "true"
|
||||
|
||||
class AClass
|
||||
{
|
||||
AClass getA() {
|
||||
int i = <caret>this.fff;
|
||||
return null;
|
||||
|
||||
}
|
||||
static int fff;
|
||||
}
|
||||
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// "Access static 'AClass.getA()' via class 'AClass' reference" "true"
|
||||
|
||||
class AClass
|
||||
{
|
||||
static AClass getA() {
|
||||
return null;
|
||||
}
|
||||
static int fff;
|
||||
}
|
||||
|
||||
class acc {
|
||||
int f() {
|
||||
AClass a = null;
|
||||
<caret>a.getA();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
// "Access static 'AClass.R.rr' via class 'AClass.R' reference" "false"
|
||||
|
||||
class AClass
|
||||
{
|
||||
private static class R {
|
||||
static int rr = 0;
|
||||
}
|
||||
public R getR() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
// AClass.R is not accessible there
|
||||
class ss {
|
||||
void f(AClass d){
|
||||
int i = <caret>d.getR().rr;
|
||||
}
|
||||
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Access static 'AClass.stat' via class 'AClass' reference" "true"
|
||||
|
||||
class AClass {
|
||||
static boolean stat;
|
||||
void foo (boolean stat) {
|
||||
this.stat<caret> = stat;
|
||||
}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// "Access static 'AClass.R.rr' via class 'R' reference" "true"
|
||||
|
||||
class AClass
|
||||
{
|
||||
public static class R {
|
||||
static int rr = 0;
|
||||
}
|
||||
public R getR() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
class ss {
|
||||
void f(AClass d){
|
||||
int i = <caret>d.getR().rr;
|
||||
}
|
||||
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Add Catch Clause(s)" "true"
|
||||
class a {
|
||||
void g() throws Exception {
|
||||
}
|
||||
void f() {
|
||||
try {
|
||||
g();
|
||||
} catch (Error e) {
|
||||
} catch (Exception e) {
|
||||
<caret><selection>e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.</selection>
|
||||
}
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// "Add Catch Clause(s)" "true"
|
||||
class a {
|
||||
void g() throws Exception {
|
||||
}
|
||||
|
||||
// initializer
|
||||
{
|
||||
try {
|
||||
// comment before
|
||||
g();
|
||||
// comment after
|
||||
} catch (Exception e) {
|
||||
<caret><selection>e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.</selection>
|
||||
}
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// "Add Catch Clause(s)" "true"
|
||||
class MyException1 extends Exception {}
|
||||
class MyException2 extends Exception {}
|
||||
|
||||
class Test {
|
||||
void foo () throws MyException1, MyException2 {}
|
||||
|
||||
void bar () {
|
||||
try {
|
||||
foo();
|
||||
} catch (MyException1 e) {
|
||||
} catch (MyException2 myException2) {
|
||||
<caret><selection>myException2.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.</selection>
|
||||
}
|
||||
}
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
// "Add Catch Clause(s)" "true"
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
|
||||
class CatchExceptions {
|
||||
|
||||
void foo() throws java.io.IOException, java.io.FileNotFoundException {
|
||||
|
||||
}
|
||||
|
||||
void bar() {
|
||||
try {
|
||||
foo();
|
||||
} catch (FileNotFoundException e) {
|
||||
<selection>e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.</selection>
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Add Catch Clause(s)" "true"
|
||||
class a {
|
||||
void g() throws Exception {
|
||||
}
|
||||
void f() {
|
||||
try {
|
||||
<caret>g();
|
||||
} catch (Error e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
// "Add Catch Clause(s)" "false"
|
||||
// should not try to add catch clauses across method boundaries
|
||||
class s {
|
||||
int f() throws Exception {
|
||||
Runnable runnable = new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
Runnable runnable = new Runnable() {
|
||||
public void run() {
|
||||
<caret>int i = f();//
|
||||
}
|
||||
};
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
};
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// "Add Catch Clause(s)" "true"
|
||||
class a {
|
||||
void g() throws Exception {
|
||||
}
|
||||
|
||||
// initializer
|
||||
{
|
||||
try {
|
||||
// comment before
|
||||
<caret>g();
|
||||
// comment after
|
||||
}
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// "Add Catch Clause(s)" "true"
|
||||
class MyException1 extends Exception {}
|
||||
class MyException2 extends Exception {}
|
||||
|
||||
class Test {
|
||||
void foo () throws MyException1, MyException2 {}
|
||||
|
||||
void bar () {
|
||||
try {
|
||||
<caret>foo();
|
||||
} catch (MyException1 e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Add Catch Clause(s)" "true"
|
||||
class CatchExceptions {
|
||||
|
||||
void foo() throws java.io.IOException, java.io.FileNotFoundException {
|
||||
|
||||
}
|
||||
|
||||
void bar() {
|
||||
try {
|
||||
foo();<caret>
|
||||
}
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Add Method Body" "true"
|
||||
class a {
|
||||
void f() {
|
||||
<selection>//To change body of created methods use File | Settings | File Templates.</selection><caret>
|
||||
}
|
||||
}
|
||||
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Add Method Body" "true"
|
||||
class a {
|
||||
String f() {
|
||||
<selection>return null; //To change body of created methods use File | Settings | File Templates.</selection><caret>
|
||||
}
|
||||
}
|
||||
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Add Method Body" "true"
|
||||
class a {
|
||||
a() {
|
||||
<selection>//To change body of created methods use File | Settings | File Templates.</selection><caret>
|
||||
}
|
||||
}
|
||||
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Add Method Body" "true"
|
||||
class a {
|
||||
String f() {
|
||||
<selection>return null; //To change body of created methods use File | Settings | File Templates.</selection><caret>
|
||||
}
|
||||
}
|
||||
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// "Add Method Body" "true"
|
||||
class a {
|
||||
<caret>void f();
|
||||
}
|
||||
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// "Add Method Body" "true"
|
||||
class a {
|
||||
<caret>String f();
|
||||
}
|
||||
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// "Add Method Body" "true"
|
||||
class a {
|
||||
<caret>a();
|
||||
}
|
||||
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// "Add Method Body" "true"
|
||||
class a {
|
||||
<caret>abstract String f();
|
||||
}
|
||||
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// "Add Method Body" "false"
|
||||
interface a {
|
||||
<caret>String f();
|
||||
}
|
||||
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Add 'new int[]'" "true"
|
||||
class c {
|
||||
void f() {
|
||||
int[] a;
|
||||
a = <caret>new int[]{1, 2};
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Add 'new int[]'" "true"
|
||||
class c {
|
||||
void f() {
|
||||
int[] a;
|
||||
a = <caret>{1, 2};
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// "Add on demand static import for 'test.Bar'" "true"
|
||||
package test;
|
||||
|
||||
import static test.Bar.*;
|
||||
|
||||
class Bar {
|
||||
public static final void f() {}
|
||||
}
|
||||
public class Foo {
|
||||
public static final void f(int i) {}
|
||||
|
||||
{
|
||||
<caret>Bar.f(); // invoke 'add on demand static import' for Bar class here. The call is now done to other method.
|
||||
}
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
// "Add on demand static import for 'test.Bar'" "true"
|
||||
package test;
|
||||
|
||||
import static test.Bar.*;
|
||||
|
||||
class Bar {
|
||||
public static final void f() {
|
||||
}
|
||||
}
|
||||
|
||||
public class Foo {
|
||||
{
|
||||
f(); // invoke 'add on demand static import' for Bar class here. The call is now done to other method.
|
||||
}
|
||||
|
||||
static class D {
|
||||
public static final void f(int i) {
|
||||
}
|
||||
|
||||
{
|
||||
Bar.f(); // invoke 'add on demand static import' for Bar class here. The call is now done to other method.
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
f(); // invoke 'add on demand static import' for Bar class here. The call is now done to other method.
|
||||
}
|
||||
|
||||
{
|
||||
f(); // invoke 'add on demand static import' for Bar class here. The call is now done to other method.
|
||||
}
|
||||
|
||||
{
|
||||
f(); // invoke 'add on demand static import' for Bar class here. The call is now done to other method.
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// "Add on demand static import for 'test.Bar'" "false"
|
||||
package test;
|
||||
import static test.Bar.*;
|
||||
|
||||
class Bar {
|
||||
public static final void f() {}
|
||||
}
|
||||
public class Foo {
|
||||
public static final void f(int i) {}
|
||||
|
||||
{
|
||||
<caret>Bar.f(); // invoke 'add on demand static import' for Bar class here. The call is now done to other method.
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Add on demand static import for 'test.Bar'" "true"
|
||||
package test;
|
||||
|
||||
class Bar {
|
||||
public static final void f() {}
|
||||
}
|
||||
public class Foo {
|
||||
public static final void f(int i) {}
|
||||
|
||||
{
|
||||
<caret>Bar.f(); // invoke 'add on demand static import' for Bar class here. The call is now done to other method.
|
||||
}
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
// "Add on demand static import for 'test.Bar'" "true"
|
||||
package test;
|
||||
|
||||
class Bar {
|
||||
public static final void f() {
|
||||
}
|
||||
}
|
||||
|
||||
public class Foo {
|
||||
{
|
||||
Bar.f(); // invoke 'add on demand static import' for Bar class here. The call is now done to other method.
|
||||
}
|
||||
|
||||
static class D {
|
||||
public static final void f(int i) {
|
||||
}
|
||||
|
||||
{
|
||||
Bar.f(); // invoke 'add on demand static import' for Bar class here. The call is now done to other method.
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
Bar.f(); // invoke 'add on demand static import' for Bar class here. The call is now done to other method.
|
||||
}
|
||||
|
||||
{
|
||||
Bar.f(); // invoke 'add on demand static import' for Bar class here. The call is now done to other method.
|
||||
}
|
||||
|
||||
{
|
||||
<caret>Bar.f(); // invoke 'add on demand static import' for Bar class here. The call is now done to other method.
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// "Add Return Statement" "true"
|
||||
class a {
|
||||
int f() {
|
||||
return <caret><selection>0</selection>;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
// "Add Return Statement" "true"
|
||||
class a {
|
||||
String f() {
|
||||
return <caret><selection>null</selection>;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
// "Add Return Statement" "true"
|
||||
class a {
|
||||
int f() {
|
||||
int i = 0;
|
||||
return <caret><selection>i</selection>;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
// "Add Return Statement" "true"
|
||||
class a {
|
||||
int f(int p) {
|
||||
return <caret><selection>p</selection>;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
// "Add Return Statement" "true"
|
||||
class a {
|
||||
int f() {
|
||||
short i = 0;
|
||||
return <caret><selection>0</selection>;
|
||||
}
|
||||
}
|
||||
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// "Add Return Statement" "true"
|
||||
class a {
|
||||
int f() {
|
||||
<caret>}
|
||||
}
|
||||
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// "Add Return Statement" "true"
|
||||
class a {
|
||||
String f() {
|
||||
<caret>}
|
||||
}
|
||||
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Add Return Statement" "true"
|
||||
class a {
|
||||
int f() {
|
||||
int i = 0;
|
||||
<caret>}
|
||||
}
|
||||
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// "Add Return Statement" "true"
|
||||
class a {
|
||||
int f(int p) {
|
||||
<caret>}
|
||||
}
|
||||
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Add Return Statement" "true"
|
||||
class a {
|
||||
int f() {
|
||||
short i = 0;
|
||||
<caret>}
|
||||
}
|
||||
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Add Method Body" "false"
|
||||
class a {
|
||||
String f() {
|
||||
return null;
|
||||
<caret>}
|
||||
}
|
||||
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Add Runtime Exception(s) to Method Signature" "true"
|
||||
class a {
|
||||
int f() throws RuntimeException {
|
||||
throw new RuntimeException()<caret>;
|
||||
}
|
||||
}
|
||||
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Add Runtime Exception(s) to Method Signature" "true"
|
||||
class a {
|
||||
int f() {
|
||||
throw new RuntimeException()<caret>;
|
||||
}
|
||||
}
|
||||
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Add Runtime Exception(s) to Method Signature" "false"
|
||||
class a {
|
||||
int f() throws RuntimeException{
|
||||
throw new RuntimeException()<caret>;
|
||||
}
|
||||
}
|
||||
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Add explicit type arguments" "true"
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Collections;
|
||||
|
||||
class Example {
|
||||
void f(List<String> list) {}
|
||||
|
||||
void g() {
|
||||
f(<caret>Collections.<String>emptyList());
|
||||
}
|
||||
}
|
||||
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Add explicit type arguments" "true"
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
class Example {
|
||||
void f(Collection<String> list) {}
|
||||
|
||||
void g() {
|
||||
f(<caret>Collections.<String>emptyList());
|
||||
}
|
||||
}
|
||||
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Add explicit type arguments" "true"
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Collections;
|
||||
|
||||
class Example {
|
||||
Example(List<String> list) {}
|
||||
|
||||
void g() {
|
||||
new Example(<caret>Collections.<String>emptyList());
|
||||
}
|
||||
}
|
||||
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Add explicit type arguments" "true"
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Collections;
|
||||
|
||||
class Example {
|
||||
void f(List<String> list) {}
|
||||
|
||||
void g() {
|
||||
f(<caret>Collections.emptyList());
|
||||
}
|
||||
}
|
||||
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Add explicit type arguments" "true"
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
class Example {
|
||||
void f(Collection<String> list) {}
|
||||
|
||||
void g() {
|
||||
f(<caret>Collections.emptyList());
|
||||
}
|
||||
}
|
||||
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Add explicit type arguments" "true"
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Collections;
|
||||
|
||||
class Example {
|
||||
Example(List<String> list) {}
|
||||
|
||||
void g() {
|
||||
new Example(<caret>Collections.emptyList());
|
||||
}
|
||||
}
|
||||
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Cast to 'char'" "true"
|
||||
class a {
|
||||
void f(int i) {
|
||||
<caret>char c = (char) i;
|
||||
}
|
||||
}
|
||||
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// "Cast to 'A.Iterator<java.lang.String>'" "true"
|
||||
class A {
|
||||
interface Iterator<T> {
|
||||
}
|
||||
|
||||
class List<T> {
|
||||
Iterator<T> iterator() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
void method() {
|
||||
List l = new List();
|
||||
<caret>Iterator<String> it = (Iterator<String>) l.iterator();
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Cast to 'b'" "true"
|
||||
class a {
|
||||
void f(a a) {
|
||||
<caret>b b = (b) a;
|
||||
}
|
||||
}
|
||||
class b extends a {}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// "Cast to 'int'" "true"
|
||||
class a {
|
||||
void f() {
|
||||
int[] ii = {<caret>(int) 1.3};
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Cast to 'int'" "true"
|
||||
class a {
|
||||
void f() {
|
||||
int i;
|
||||
<caret>i = (int) 3.4f;
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Cast to 'float'" "true"
|
||||
class a {
|
||||
float f() {
|
||||
double d = 4;
|
||||
return <caret>(float) d;
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Cast to 'int'" "true"
|
||||
class a {
|
||||
void f() {
|
||||
double d = 4;
|
||||
switch (<caret>(int) d) {
|
||||
}
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// "Cast to 'char'" "true"
|
||||
class a {
|
||||
void f() {
|
||||
double d = 4;
|
||||
switch ('c') {
|
||||
case <caret>(char) 3.3:
|
||||
}
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Cast to 'java.lang.String'" "true"
|
||||
class a {
|
||||
void f() {
|
||||
Object y = null;
|
||||
String s = <caret>(String) y;
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Cast to 'B'" "true"
|
||||
class A {
|
||||
void f(B b) {
|
||||
B s = <caret>b == null ? (B) this : b;
|
||||
}
|
||||
}
|
||||
class B extends A {}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Cast to 'B'" "true"
|
||||
class A {
|
||||
void f(B b) {
|
||||
B s = <caret>b == null ? null : (B) this;
|
||||
}
|
||||
}
|
||||
class B extends A {}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Cast to 'B'" "true"
|
||||
class A {
|
||||
void f(B b) {
|
||||
B s = <caret>(B) (b == null ? this : this);
|
||||
}
|
||||
}
|
||||
class B extends A {}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Cast to 'char'" "true"
|
||||
class a {
|
||||
void f(int i) {
|
||||
<caret>char c = i;
|
||||
}
|
||||
}
|
||||
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// "Cast to 'A.Iterator<java.lang.String>'" "true"
|
||||
class A {
|
||||
interface Iterator<T> {
|
||||
}
|
||||
|
||||
class List<T> {
|
||||
Iterator<T> iterator() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
void method() {
|
||||
List l = new List();
|
||||
<caret>Iterator<String> it = (Iterator<Object>)l.iterator();
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Cast to 'b'" "true"
|
||||
class a {
|
||||
void f(a a) {
|
||||
<caret>b b = a;
|
||||
}
|
||||
}
|
||||
class b extends a {}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// "Cast to 'int'" "true"
|
||||
class a {
|
||||
void f() {
|
||||
int[] ii = { <caret>1.3 };
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Cast to 'int'" "true"
|
||||
class a {
|
||||
void f() {
|
||||
int i;
|
||||
<caret>i = 3.4f;
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Cast to 'float'" "true"
|
||||
class a {
|
||||
float f() {
|
||||
double d = 4;
|
||||
return <caret>d;
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Cast to 'int'" "true"
|
||||
class a {
|
||||
void f() {
|
||||
double d = 4;
|
||||
switch (<caret>d) {
|
||||
}
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// "Cast to 'char'" "true"
|
||||
class a {
|
||||
void f() {
|
||||
double d = 4;
|
||||
switch ('c') {
|
||||
case <caret>3.3:
|
||||
}
|
||||
}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// "Cast to 'java.lang.String'" "false"
|
||||
class a {
|
||||
void f() {
|
||||
String s = <caret>1;
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Cast to 'java.lang.String'" "true"
|
||||
class a {
|
||||
void f() {
|
||||
Object y = null;
|
||||
String s = <caret>(Integer) y;
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Cast to 'B'" "true"
|
||||
class A {
|
||||
void f(B b) {
|
||||
B s = <caret>b == null ? this : b;
|
||||
}
|
||||
}
|
||||
class B extends A {}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Cast to 'B'" "true"
|
||||
class A {
|
||||
void f(B b) {
|
||||
B s = <caret>b == null ? null : this;
|
||||
}
|
||||
}
|
||||
class B extends A {}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Cast to 'B'" "true"
|
||||
class A {
|
||||
void f(B b) {
|
||||
B s = <caret>b == null ? this : this;
|
||||
}
|
||||
}
|
||||
class B extends A {}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// "Initialize variable 'i'" "true"
|
||||
|
||||
class AClass
|
||||
{
|
||||
int f() {
|
||||
int i = <caret><selection>0</selection>;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Initialize variable 'f'" "true"
|
||||
|
||||
class AClass
|
||||
{
|
||||
final AClass f = <caret><selection>null</selection>;
|
||||
}
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// "Initialize variable 'i'" "true"
|
||||
|
||||
class AClass
|
||||
{
|
||||
int f() {
|
||||
int i;
|
||||
return <caret>i;
|
||||
}
|
||||
}
|
||||
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Initialize variable 'f'" "true"
|
||||
|
||||
class AClass
|
||||
{
|
||||
final AClass f<caret>;
|
||||
}
|
||||
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
// "Annotate method as @NotNull" "true"
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
class X {
|
||||
@NotNull
|
||||
String foo() {
|
||||
return "X";
|
||||
}
|
||||
}
|
||||
class Y extends X{
|
||||
String foo() {
|
||||
return "Y";
|
||||
}
|
||||
}
|
||||
class Z extends Y {
|
||||
String foo<caret>() { // trigger quick fix for inspection here
|
||||
return "Z";
|
||||
}
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
// "Annotate method as @NotNull" "true"
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
class X {
|
||||
@NotNull
|
||||
String annotateBase() {
|
||||
return "X";
|
||||
}
|
||||
}
|
||||
class Y extends X{
|
||||
@NotNull
|
||||
String annotateBase() {
|
||||
return "Y";
|
||||
}
|
||||
}
|
||||
class Z extends Y {
|
||||
@NotNull
|
||||
String annotateBase<caret>() { // trigger quick fix for inspection here
|
||||
return "Z";
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Remove annotation" "true"
|
||||
|
||||
import org.jetbrains.annotations.*;
|
||||
|
||||
class Foo {
|
||||
<caret>@Nullable
|
||||
String foo(){return "";}
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
// "Annotate method as @NotNull" "true"
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
class X {
|
||||
@NotNull
|
||||
String dontAnnotateBase() {
|
||||
return "X";
|
||||
}
|
||||
}
|
||||
class Y extends X{
|
||||
String dontAnnotateBase() {
|
||||
return "Y";
|
||||
}
|
||||
}
|
||||
class Z extends Y {
|
||||
@NotNull
|
||||
String dontAnnotateBase<caret>() { // trigger quick fix for inspection here
|
||||
return "Z";
|
||||
}
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
// "Annotate overridden methods as @NotNull" "true"
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
abstract class P2 {
|
||||
@NotNull<caret>
|
||||
String foo(@NotNull P p) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
class PPP extends P2 {
|
||||
@NotNull
|
||||
String foo(P p) {
|
||||
return super.foo(p);
|
||||
}
|
||||
}
|
||||
class PPP2 extends P2 {
|
||||
|
||||
@NotNull
|
||||
String foo(P p) {
|
||||
return super.foo(p);
|
||||
}
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
// "Annotate overridden methods parameters as @NotNull" "true"
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
abstract class P2 {
|
||||
@NotNull
|
||||
String foo(@NotNull<caret> P p) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
class PPP extends P2 {
|
||||
String foo(@NotNull P p) {
|
||||
return super.foo(p);
|
||||
}
|
||||
}
|
||||
class PPP2 extends P2 {
|
||||
|
||||
String foo(@NotNull P p) {
|
||||
return super.foo(p);
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Remove annotation" "true"
|
||||
|
||||
import org.jetbrains.annotations.*;
|
||||
|
||||
class Foo {
|
||||
<caret>int foo(){return 0;}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// "Annotate overridden methods as @NotNull" "true"
|
||||
|
||||
import org.jetbrains.annotations.*;
|
||||
|
||||
public class XEM {
|
||||
<caret>@NotNull
|
||||
String f(){
|
||||
return "";
|
||||
}
|
||||
}
|
||||
class XC extends XEM {
|
||||
@NotNull
|
||||
String f() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
// "Annotate method as @NotNull" "true"
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
class X {
|
||||
@NotNull
|
||||
String foo() {
|
||||
return "X";
|
||||
}
|
||||
}
|
||||
class Y extends X{
|
||||
String foo() {
|
||||
return "Y";
|
||||
}
|
||||
}
|
||||
class Z extends Y {
|
||||
String foo<caret>() { // trigger quick fix for inspection here
|
||||
return "Z";
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
// "Annotate method as @NotNull" "true"
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
class X {
|
||||
@NotNull
|
||||
String annotateBase() {
|
||||
return "X";
|
||||
}
|
||||
}
|
||||
class Y extends X{
|
||||
String annotateBase() {
|
||||
return "Y";
|
||||
}
|
||||
}
|
||||
class Z extends Y {
|
||||
String annotateBase<caret>() { // trigger quick fix for inspection here
|
||||
return "Z";
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Remove annotation" "true"
|
||||
|
||||
import org.jetbrains.annotations.*;
|
||||
|
||||
class Foo {
|
||||
<caret>@NotNull @Nullable
|
||||
String foo(){return "";}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
// "Annotate method as @NotNull" "true"
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
class X {
|
||||
@NotNull
|
||||
String dontAnnotateBase() {
|
||||
return "X";
|
||||
}
|
||||
}
|
||||
class Y extends X{
|
||||
String dontAnnotateBase() {
|
||||
return "Y";
|
||||
}
|
||||
}
|
||||
class Z extends Y {
|
||||
String dontAnnotateBase<caret>() { // trigger quick fix for inspection here
|
||||
return "Z";
|
||||
}
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
// "Annotate overridden methods as @NotNull" "true"
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
abstract class P2 {
|
||||
@NotNull<caret>
|
||||
String foo(@NotNull P p) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
class PPP extends P2 {
|
||||
String foo(P p) {
|
||||
return super.foo(p);
|
||||
}
|
||||
}
|
||||
class PPP2 extends P2 {
|
||||
|
||||
String foo(P p) {
|
||||
return super.foo(p);
|
||||
}
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
// "Annotate overridden methods parameters as @NotNull" "true"
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
abstract class P2 {
|
||||
@NotNull
|
||||
String foo(@NotNull<caret> P p) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
class PPP extends P2 {
|
||||
String foo(P p) {
|
||||
return super.foo(p);
|
||||
}
|
||||
}
|
||||
class PPP2 extends P2 {
|
||||
|
||||
String foo(P p) {
|
||||
return super.foo(p);
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Remove annotation" "true"
|
||||
|
||||
import org.jetbrains.annotations.*;
|
||||
|
||||
class Foo {
|
||||
<caret>@NotNull
|
||||
int foo(){return 0;}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user