use mockJdk18 by default in LightCodeInsightTestCase; remove dependency on swing/net classes in some tests

This commit is contained in:
Alexey Kudravtsev
2016-07-20 15:47:18 +03:00
parent 6b15812a4e
commit db48c64473
68 changed files with 359 additions and 210 deletions
@@ -4,8 +4,8 @@ import java.io.FilenameFilter;
class A {
{
new java.io.File("aaa").list(new FilenameFilter() {
public boolean accept(File dir, String name) {
<selection>return false;</selection>
public boolean accept(File file, String s) {
return false;
}
});
}
@@ -1,14 +1,13 @@
// access problems in inner classes
import java.awt.*;
import java.beans.beancontext.BeanContextServicesSupport;
import java.beans.beancontext.BeanContextServicesSupport.<error descr="'java.beans.beancontext.BeanContextServicesSupport.BCSSChild' has protected access in 'java.beans.beancontext.BeanContextServicesSupport'">BCSSChild</error>;
import x.BeanContextServicesSupport;
import x.BeanContextServicesSupport.<error descr="'x.BeanContextServicesSupport.BCSSChild' has protected access in 'x.BeanContextServicesSupport'">BCSSChild</error>;
class a extends Component {
class a extends x.Component {
void f() {
FlipBufferStrategy s = null;
int i = s.<error descr="'numBuffers' has protected access in 'java.awt.Component.FlipBufferStrategy'">numBuffers</error>;
s.<error descr="'createBuffers(int, java.awt.BufferCapabilities)' has protected access in 'java.awt.Component.FlipBufferStrategy'">createBuffers</error>(1,null);
int i = s.<error descr="'numBuffers' has protected access in 'x.Component.FlipBufferStrategy'">numBuffers</error>;
s.<error descr="'createBuffers(int)' has protected access in 'x.Component.FlipBufferStrategy'">createBuffers</error>(1);
// TODO
// now cannot distinquish private from package-private in class files
@@ -19,9 +18,9 @@ class a extends Component {
class ddd extends BeanContextServicesSupport {
BCSSChild.<error descr="'java.beans.beancontext.BeanContextServicesSupport.BCSSChild.BCSSCServiceClassRef' is not public in 'java.beans.beancontext.BeanContextServicesSupport.BCSSChild'. Cannot be accessed from outside package">BCSSCServiceClassRef</error> fd = null;
BCSSChild.<error descr="'x.BeanContextServicesSupport.BCSSChild.BCSSCServiceClassRef' is not public in 'x.BeanContextServicesSupport.BCSSChild'. Cannot be accessed from outside package">BCSSCServiceClassRef</error> fd = null;
void ff() {
fd.<error descr="'addRequestor(java.lang.Object, java.beans.beancontext.BeanContextServiceRevokedListener)' is not public in 'java.beans.beancontext.BeanContextServicesSupport.BCSSChild.BCSSCServiceClassRef'. Cannot be accessed from outside package">addRequestor</error>(null,null);
fd.<error descr="'addRequestor(java.lang.Object)' is not public in 'x.BeanContextServicesSupport.BCSSChild.BCSSCServiceClassRef'. Cannot be accessed from outside package">addRequestor</error>(null,null);
}
}
@@ -1,6 +1,6 @@
// assign to final
import java.io.*;
import java.net.*;
public class a21 {
final int fi;
{
@@ -1,6 +1,6 @@
/// assignment compatible types
import java.io.*;
import java.net.*;
public class a {
final int FI = 2;
final int FIBIG = 200000000;
@@ -1,6 +1,6 @@
// cyclic inhertiance
import java.io.*;
import java.net.*;
<error descr="Cyclic inheritance involving 'Foo'">class Foo extends Foo</error> {
}
@@ -1,6 +1,6 @@
// duplicate labels
import java.io.*;
import java.net.*;
public class a {
@@ -1,7 +1,8 @@
// Exception is never thrown in method
import java.io.*;
import java.sql.*;
class SQLException extends Exception {}
class a {
private void f() throws <warning descr="Exception 'java.io.IOException' is never thrown in the method">IOException</warning> {
@@ -50,7 +51,7 @@ final class Final {
class a1 {
a1() throws <warning descr="Exception 'java.io.IOException' is never thrown in the method">java.io.IOException</warning>, <warning descr="Exception 'java.sql.SQLException' is never thrown in the method">SQLException</warning>{
a1() throws <warning descr="Exception 'java.io.IOException' is never thrown in the method">java.io.IOException</warning>, <warning descr="Exception 'SQLException' is never thrown in the method">SQLException</warning>{
}
}
@@ -1,5 +1,5 @@
import java.io.*;
import java.sql.*;
////////////
class x {
@@ -1,6 +1,6 @@
// fields double initialization
import java.io.*;
import java.net.*;
class Foo {
final int k;
final int ff = 5;
@@ -1,7 +1,5 @@
// final Fields initialization
import java.io.*;
import java.net.*;
import java.awt.event.*;
class a {
/**
@@ -87,8 +85,8 @@ class Test {
}
private final String text;
public Test() {
new ActionListener() {
public void actionPerformed(ActionEvent e) {
new Runnable() {
public void run() {
doSomething(text);////
}
};
@@ -1,6 +1,6 @@
/// forward references
import java.io.*;
import java.net.*;
public class a {
@@ -1,6 +1,5 @@
/// initalizers completion
import java.io.*;
import java.net.*;
public class a {
@@ -26,12 +25,17 @@ class a2 {
<error descr="Unhandled exception: java.io.IOException">a2()</error> {}
}
class SocketException extends IOException {
}
class ConnectException extends SocketException {
}
class a3 {
{
if (1==2) <error descr="Unhandled exception: java.net.SocketException">throw new SocketException();</error>
if (1==2) <error descr="Unhandled exception: SocketException">throw new SocketException();</error>
}
<error descr="Unhandled exception: java.net.SocketException">a3() throws ConnectException</error> {}
<error descr="Unhandled exception: SocketException">a3() throws ConnectException</error> {}
}
class b {
@@ -1,6 +1,6 @@
// labels
import java.io.*;
import java.net.*;
class a {
void f() {
@@ -66,4 +66,4 @@ class AlreadyInUse {
}
};
}
}
}
@@ -1,5 +1,4 @@
import java.io.*;
import java.net.*;
import java.util.*;
public class a {
@@ -1,6 +1,6 @@
//Missing return statement
import java.io.*;
import java.net.*;
public class a {
interface ii {}
@@ -1,13 +1,17 @@
// throws conflicts on overriding/ override final
import java.io.*;
import java.net.*;
public class a extends c3 {
public void f() throws <error descr="'f()' in 'a' clashes with 'f()' in 'c3'; overridden method does not throw 'java.lang.Exception'">Exception</error> {
}
}
class SocketException extends IOException {
}
class ConnectException extends SocketException {
}
interface i {
void f() throws java.net.SocketException;
void f() throws SocketException;
}
class c2 implements i {
public void f() throws <error descr="'f()' in 'c2' clashes with 'f()' in 'i'; overridden method does not throw 'java.io.IOException'">java.io.IOException</error> {}
@@ -17,11 +21,11 @@ class c2i implements i {
}
class c3 implements i {
public void f() throws java.net.ConnectException {}
public void f() throws ConnectException {}
}
class c4 extends c3 {
public void f() throws java.net.ConnectException {}
public void f() throws ConnectException {}
}
interface MethodsFromObject {
@@ -2,7 +2,6 @@
import java.io.*;
import java.lang.Override;
import java.lang.String;
import java.net.*;
class A {
A(int i) {}
@@ -1,6 +1,9 @@
// silly asignment
import javax.swing.*;
class JPanel {
JPanel getSize() { return this; }
int height;
}
class a {
int f;
JPanel fpanel;
@@ -1,7 +1,7 @@
// single import conflict
import java.sql.Date;
<error descr="'java.sql.Date' is already defined in a single-type import">import java.util.Date;</error>
import java.sql.*;
import sql.Date;
<error descr="'sql.Date' is already defined in a single-type import">import java.util.Date;</error>
import sql.*;
import java.util.*;
// multiple single-type import of the same class is fine
import java.io.IOException;
@@ -1,6 +1,6 @@
// method override
import java.io.*;
import java.net.*;
class a extends a1 {
<error descr="Static method 'f()' in 'a' cannot override instance method 'f()' in 'a1'">public static void f()</error> { }
@@ -2,7 +2,6 @@
import java.io.*;
import java.net.*;
/**
class a {
@@ -1,6 +1,4 @@
/// labels
import java.io.*;
import java.net.*;
public class a {
@@ -1,6 +1,6 @@
// unhandled exceptions from superclases/etc
import java.io.*;
import java.net.*;
class a {
a(int i) {}
}
@@ -1,6 +1,6 @@
// unreachables
import java.io.*;
import java.net.*;
public class a {
interface ii {}
@@ -135,16 +135,21 @@ interface ii {}
int i = 6;
}
}
void cf4() throws java.net.SocketException {
void cf4() throws SocketException {
try {
bind();
} catch (java.net.SocketException se) {
} catch (SocketException se) {
throw se;
} catch(java.io.IOException e) {
throw new java.net.SocketException(e.getMessage());
} catch(IOException e) {
throw new SocketException(e.getMessage());
}
}
void bind() throws java.net.SocketException {}
static class SocketException extends IOException {
public SocketException(String message) {
super(message);
}
}
void bind() throws SocketException {}
void cf5() {
@@ -1,6 +1,6 @@
// vars double initialization
import java.io.*;
import java.net.*;
public class a21 {
void f1(int i) {
@@ -1,12 +1,14 @@
// "Create class 'MyTableModel'" "true"
import javax.swing.*;
import javax.swing.table.TableModel;
public class Test {
public static void main() {
JTable table = new JTable(new MyTableModel());
}
}
class JTable {
JTable(TableModel t) {}
}
interface TableModel {}
<caret>public class MyTableModel implements TableModel {
}
@@ -1,8 +1,11 @@
// "Create class 'MyTableModel'" "true"
import javax.swing.*;
public class Test {
public static void main() {
JTable table = new JTable(new MyTable<caret>Model());
}
}
}
class JTable {
JTable(TableModel t) {}
}
interface TableModel {}
@@ -1,14 +1,13 @@
// "Create field 'panel'" "true"
import javax.swing.*;
import java.io.*;
class Test {
private JPanel panel;
private File panel;
void foo(JPanel container) {
Object foo(File container) {
if (panel == null) {
panel = new JPanel();
panel.setOpaque(true);
container.add(panel);
panel = new File();
return new File(container, panel.getName());
}
}
}
@@ -1,12 +1,11 @@
// "Create field 'panel'" "true"
import javax.swing.*;
import java.io.*;
class Test {
void foo(JPanel container) {
Object foo(File container) {
if (p<caret>anel == null) {
panel = new JPanel();
panel.setOpaque(true);
container.add(panel);
panel = new File();
return new File(container, panel.getName());
}
}
}
@@ -1,6 +1,4 @@
// "Create inner class 'MyTableModel'" "true"
import javax.swing.*;
import javax.swing.table.TableModel;
public class Test {
public static void main() {
@@ -9,4 +7,8 @@ public class Test {
private static class MyTableModel implements TableModel {
}
}
}
class JTable {
JTable(TableModel t) {}
}
interface TableModel {}
@@ -1,8 +1,11 @@
// "Create inner class 'MyTableModel'" "true"
import javax.swing.*;
public class Test {
public static void main() {
JTable table = new JTable(new MyTable<caret>Model());
}
}
}
class JTable {
JTable(TableModel t) {}
}
interface TableModel {}