Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
IPDSnelting
mjtest-tests
Commits
edd01816
Commit
edd01816
authored
Nov 16, 2018
by
updjx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
trying to fix disscusion comments
parent
c1c61750
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
19 deletions
+25
-19
semantic/AttributeKill.valid.java
semantic/AttributeKill.valid.java
+6
-8
semantic/NoParameterDeclaration.invalid.mj
semantic/NoParameterDeclaration.invalid.mj
+4
-1
semantic/OverwriteAttributeWithUndeclaredVariable.invalid.mj
semantic/OverwriteAttributeWithUndeclaredVariable.invalid.mj
+10
-5
semantic/RightVariable.valid.java
semantic/RightVariable.valid.java
+5
-5
No files found.
semantic/AttributeKill.valid.java
View file @
edd01816
...
...
@@ -2,28 +2,26 @@ class AttributeKill {
public
A
objectA
;
public
static
void
main
(
String
[]
args
)
{
/* create and construct object A*/
A
objectA
=
new
A
();
objectA
.
init
();
/* set object to null*/
objectA
=
null
;
int
a
=
objectA
.
atr
;
/* calling uninitiated attribute of null object*/
int
a
=
objectA
.
atr
;
}
}
class
A
{
public
int
atr
;
/* pseudo constructor */
public
void
init
()
{
public
void
init
()
{
atr
=
2
;
}
}
\ No newline at end of file
semantic/NoParameterDeclaration.invalid.mj
View file @
edd01816
...
...
@@ -4,13 +4,16 @@
*/
class NoParameterDeclaration {
public int a;
public static void main(String[] args) {
NoParameterDeclaration testObj = new NoParameterDeclaration();
/*there is no parameter given here*/
testObj.test();
}
public void test
(int i) {
public void test(int i) {
int a = i;
}
...
...
semantic/OverwriteAttributeWithUndeclaredVariable.invalid.mj
View file @
edd01816
class OverwriteAttributeWithUndeclaredVariable {
public static void main(String[] args) {}
public String a;
public
void test (
) {
/*should break here because of undeclared unknown variable*/
int a = i
;
public
static void main(String[] args
) {
OverwriteAttributeWithUndeclaredVariable obj = new OverwriteAttributeWithUndeclaredVariable()
;
obj.test();
}
public void test() {
/*should break here because of undeclared unknown variable*/
a = i;
}
}
class String {}
class String {
}
semantic/RightVariable.valid.java
View file @
edd01816
...
...
@@ -3,7 +3,8 @@
*/
class
RightVariable
{
public
static
void
main
(
String
[]
args
)
{}
public
static
void
main
(
String
[]
args
)
{
}
public
int
Test
;
...
...
@@ -27,20 +28,19 @@ class RightVariable {
/*Overwrite test attribute with RightVariable class Attribute*/
test
.
Test
=
Test
;
/*call
local method with test
*/
/*call
class RightVariable method Test, with the test object declared in the current method
*/
Test
(
test
);
/*Overwrite class Test with with local method Test, with itself given as an obj ref..*/
test
=
Test
(
test
);
}
}
class
Test
{
public
int
Test
;
public
void
Test
()
{}
public
void
Test
()
{
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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