summaryrefslogtreecommitdiff
path: root/output/negative
diff options
context:
space:
mode:
Diffstat (limited to 'output/negative')
-rw-r--r--output/negative/BadShadow-error.java25
-rw-r--r--output/negative/CallNonSubType-error.java38
-rw-r--r--output/negative/MisuseMainArg-error.java13
-rw-r--r--output/negative/NonDistinctMethods-error.java18
-rw-r--r--output/negative/NonDistinctTypes-error.java17
-rw-r--r--output/negative/NotInt-error.java17
-rw-r--r--output/negative/StealMainArg-error.java14
-rw-r--r--output/negative/WrongAllocate-error1.java23
8 files changed, 165 insertions, 0 deletions
diff --git a/output/negative/BadShadow-error.java b/output/negative/BadShadow-error.java
new file mode 100644
index 0000000..ac337d3
--- /dev/null
+++ b/output/negative/BadShadow-error.java
@@ -0,0 +1,25 @@
+class ex33 {
+ public static void main(String[] z) {
+ A a ;
+ int[] b ;
+ a = new A() ;
+ b = new int[3] ;
+ System.out.println(a.bar(0-1, 400, 6*7)) ;
+ System.out.println(a.foo(12, 400)) ;
+ }
+}
+
+class A {
+
+ int o ;
+ int[] a ;
+
+ public int foo(int a, int b) {
+ o = 3 ;
+ return a.length ;
+ }
+
+ public int bar(int x, int y, int z) {
+ return 6 ;
+ }
+}
diff --git a/output/negative/CallNonSubType-error.java b/output/negative/CallNonSubType-error.java
new file mode 100644
index 0000000..f1cc63d
--- /dev/null
+++ b/output/negative/CallNonSubType-error.java
@@ -0,0 +1,38 @@
+class CallNonSubType {
+ public static void main(String[] z) {
+ A a ;
+ A b ;
+ C c ;
+ a = new A() ;
+ b = new A() ;
+ c = new C() ;
+ System.out.println(c.play_with_classes(a, b)) ;
+ }
+}
+
+class A {
+
+ public int get_tt() {
+ return 32 ;
+ }
+
+}
+
+class B extends A {
+
+ int useless ;
+
+}
+
+class C {
+
+ public int play_with_classes(A a, B b) {
+ int ret ;
+ int x ;
+ int y ;
+ x = a.get_tt() ;
+ y = b.get_tt() ;
+ ret = x + y ;
+ return ret ;
+ }
+}
diff --git a/output/negative/MisuseMainArg-error.java b/output/negative/MisuseMainArg-error.java
new file mode 100644
index 0000000..416559c
--- /dev/null
+++ b/output/negative/MisuseMainArg-error.java
@@ -0,0 +1,13 @@
+class StealMainArg {
+ public static void main(String[] z) {
+ z = new A() ;
+ System.out.println(z.foo(3)) ;
+ }
+}
+
+class A {
+
+ public int foo(int a) {
+ return a ;
+ }
+}
diff --git a/output/negative/NonDistinctMethods-error.java b/output/negative/NonDistinctMethods-error.java
new file mode 100644
index 0000000..cfc0b01
--- /dev/null
+++ b/output/negative/NonDistinctMethods-error.java
@@ -0,0 +1,18 @@
+class StealMainArg {
+ public static void main(String[] z) {
+ A a ;
+ a = new A() ;
+ System.out.println(a.foo(3)) ;
+ }
+}
+
+class A {
+
+ public int foo(int a) {
+ return a ;
+ }
+
+ public int foo(int b) {
+ return 1 ;
+ }
+}
diff --git a/output/negative/NonDistinctTypes-error.java b/output/negative/NonDistinctTypes-error.java
new file mode 100644
index 0000000..9909e91
--- /dev/null
+++ b/output/negative/NonDistinctTypes-error.java
@@ -0,0 +1,17 @@
+class StealMainArg {
+ public static void main(String[] z) {
+ A a ;
+ a = new A() ;
+ System.out.println(a.foo(3)) ;
+ }
+}
+
+class A {
+
+ int b ;
+ boolean b ;
+
+ public int foo(int a) {
+ return a ;
+ }
+}
diff --git a/output/negative/NotInt-error.java b/output/negative/NotInt-error.java
new file mode 100644
index 0000000..ef7f014
--- /dev/null
+++ b/output/negative/NotInt-error.java
@@ -0,0 +1,17 @@
+class NotInt {
+ public static void main(String[] z) {
+ A a ;
+ a = new A() ;
+ System.out.println(12) ;
+ }
+}
+
+class A {
+
+ public int get_tt() {
+ int a ;
+ a = 3 ;
+ return !a ;
+ }
+
+}
diff --git a/output/negative/StealMainArg-error.java b/output/negative/StealMainArg-error.java
new file mode 100644
index 0000000..e8b6286
--- /dev/null
+++ b/output/negative/StealMainArg-error.java
@@ -0,0 +1,14 @@
+class StealMainArg {
+ public static void main(String[] z) {
+ A z ;
+ z = new A() ;
+ System.out.println(z.foo(3)) ;
+ }
+}
+
+class A {
+
+ public int foo(int a) {
+ return a ;
+ }
+}
diff --git a/output/negative/WrongAllocate-error1.java b/output/negative/WrongAllocate-error1.java
new file mode 100644
index 0000000..072ac98
--- /dev/null
+++ b/output/negative/WrongAllocate-error1.java
@@ -0,0 +1,23 @@
+class WrongAllocate {
+ public static void main(String[] z) {
+ A a ;
+ B b ;
+ a = new B() ;
+ b = new A() ;
+ System.out.println(12) ;
+ }
+}
+
+class A {
+
+ public int get_tt() {
+ return 32 ;
+ }
+
+}
+
+class B extends A {
+
+ int useless ;
+
+}