Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mjtest-tests
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Joshua Bachmeier
mjtest-tests
Commits
109671e4
Commit
109671e4
authored
Nov 15, 2018
by
Christian Schwarz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
main_with_local_string_class should be invalid, see comment why
parent
21d4e131
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
10 deletions
+14
-10
semantic/main_with_local_string_class.invalid.java
semantic/main_with_local_string_class.invalid.java
+14
-0
semantic/main_with_local_string_class_compiles.java
semantic/main_with_local_string_class_compiles.java
+0
-10
No files found.
semantic/main_with_local_string_class.invalid.java
0 → 100644
View file @
109671e4
/* String shadows the default String class.
* javac won't complain because the proper main method could be defined in another class file.
* However, since MiniJava files contain the entire program, it is reasonable to expect
* that the lack of a proper main method be detected at compile time.
* Analogy:
* If gcc is invoked _without_ '-c' on a set of .c files, gcc will also invoke the linker.
* If the linker cannot find a main, the gcc "user experience" is equivalent to a compiler error.
*/
class
String
{
}
class
MainWithLocalStringShadowingJavaString
{
public
static
void
main
(
String
[]
args
)
{}
}
semantic/main_with_local_string_class_compiles.java
deleted
100644 → 0
View file @
21d4e131
/* String shadows the default String class.
* However, Java only detects the lack of a main() at runtime,
* failing with 'error: Main method not found'
*/
class
String
{
}
class
MainWithLocalStringShadowingJavaString
{
public
static
void
main
(
String
[]
args
)
{}
}
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