-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for string concatenation
- Loading branch information
1 parent
ca7d631
commit 2021a90
Showing
4 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// javac -XDstringConcat=inline -d . StringConcatInline.java | ||
|
||
package samples.javacore.strings.concat.trivial; | ||
|
||
public class StringConcatInline { | ||
public static void main(String[] args) { | ||
int result = concat(); | ||
} | ||
|
||
private static int concat() { | ||
String abc = "abc"; | ||
String def = "def"; | ||
String abcdef = abc + def; | ||
|
||
int sum = 0; | ||
for (char c : abcdef.toCharArray()) { | ||
sum += c; | ||
} | ||
|
||
return sum; | ||
} | ||
} |
Binary file added
BIN
+761 Bytes
tests/test_data/samples/javacore/strings/concat/trivial/StringConcatInline.class
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters