Skip to content

Commit 419b837

Browse files
committed
build error "incompatible types: possible lossy conversion from int to char"
Cause unknown: Not use Java11 public static String java.lang.Character.toString( int codePoint )
1 parent 6d07bbc commit 419b837

4 files changed

Lines changed: 13 additions & 2 deletions

File tree

.idea/gradle.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ android {
2323
}
2424
}
2525
compileOptions {
26-
sourceCompatibility JavaVersion.VERSION_1_8
27-
targetCompatibility JavaVersion.VERSION_1_8
26+
sourceCompatibility JavaVersion.VERSION_11
27+
targetCompatibility JavaVersion.VERSION_11
2828
}
2929
}
3030

app/src/main/java/asia/remix/java11try/MainActivity.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,9 @@ public class MainActivity extends AppCompatActivity{
99
protected void onCreate( Bundle savedInstanceState ){
1010
super.onCreate( savedInstanceState );
1111
setContentView( R.layout.activity_main );
12+
13+
int i = 0x20BB7;//surrogate pair Unicode
14+
String str = java.lang.Character.toString( i );//Java 11
15+
1216
}
1317
}

0 commit comments

Comments
 (0)