diff --git a/sandbox_common/src/org/sandbox/jdt/internal/common/LibStandardNames.java b/sandbox_common/src/org/sandbox/jdt/internal/common/LibStandardNames.java index 1889d9f9..04fe1d78 100644 --- a/sandbox_common/src/org/sandbox/jdt/internal/common/LibStandardNames.java +++ b/sandbox_common/src/org/sandbox/jdt/internal/common/LibStandardNames.java @@ -74,6 +74,10 @@ public class LibStandardNames { * */ public static final String METHOD_GET_BYTES= "getBytes"; //$NON-NLS-1$ + /** + * + */ + public static final String METHOD_FOR_NAME= "forName"; //$NON-NLS-1$ /** * */ diff --git a/sandbox_encoding_quickfix/src/org/sandbox/jdt/internal/corext/fix/UseExplicitEncodingFixCore.java b/sandbox_encoding_quickfix/src/org/sandbox/jdt/internal/corext/fix/UseExplicitEncodingFixCore.java index 97e69ddb..ff24ee43 100644 --- a/sandbox_encoding_quickfix/src/org/sandbox/jdt/internal/corext/fix/UseExplicitEncodingFixCore.java +++ b/sandbox_encoding_quickfix/src/org/sandbox/jdt/internal/corext/fix/UseExplicitEncodingFixCore.java @@ -39,6 +39,7 @@ public enum UseExplicitEncodingFixCore { + CHARSET(new StringGetBytesExplicitEncoding()), STRING_GETBYTES(new StringGetBytesExplicitEncoding()), INPUTSTREAMREADER(new InputStreamReaderExplicitEncoding()), OUTPUTSTREAMWRITER(new OutputStreamWriterExplicitEncoding()), diff --git a/sandbox_encoding_quickfix_test/src/org/sandbox/jdt/ui/tests/quickfix/Java9CleanUpTest.java b/sandbox_encoding_quickfix_test/src/org/sandbox/jdt/ui/tests/quickfix/Java9CleanUpTest.java index bf692671..3e391cfb 100644 --- a/sandbox_encoding_quickfix_test/src/org/sandbox/jdt/ui/tests/quickfix/Java9CleanUpTest.java +++ b/sandbox_encoding_quickfix_test/src/org/sandbox/jdt/ui/tests/quickfix/Java9CleanUpTest.java @@ -18,6 +18,54 @@ public class Java9CleanUpTest { enum ExplicitEncodingPatterns { +// CHARSET(""" +// package test1; +// +// import java.io.ByteArrayOutputStream; +// import java.io.InputStreamReader; +// import java.io.FileInputStream; +// import java.io.FileReader; +// import java.io.Reader; +// import java.io.FileNotFoundException; +// +// public class E1 { +// void method(String filename) { +// Charset cs1= Charset.forName("UTF-8"); +// Charset cs2= Charset.forName("UTF-16"); +// Charset cs3= Charset.forName("UTF-16BE"); +// Charset cs4= Charset.forName("UTF-16LE"); +// Charset cs5= Charset.forName("ISO-8859-1"); +// Charset cs6= Charset.forName("US-ASCII"); +// String result= cs1.toString(); +// } +// } +// } +// """, +// +// """ +// package test1; +// +// import java.io.ByteArrayOutputStream; +// import java.io.InputStreamReader; +// import java.io.FileInputStream; +// import java.io.FileReader; +// import java.io.Reader; +// import java.nio.charset.Charset; +// import java.io.FileNotFoundException; +// +// public class E1 { +// void method(String filename) { +// Charset cs1= StandardCharsets.UTF_8; +// Charset cs2= StandardCharsets.UTF_16; +// Charset cs3= StandardCharsets.UTF_16BE; +// Charset cs4= StandardCharsets.UTF_16LE; +// Charset cs5= StandardCharsets.ISO_8859_1; +// Charset cs6= StandardCharsets.US_ASCII; +// String result= cs.toString(); +// } +// } +// } +// """), BYTEARRAYOUTSTREAM(""" package test1;