aboutsummaryrefslogtreecommitdiff
path: root/src/utils/lombok/core
diff options
context:
space:
mode:
authorRawi01 <Rawi01@users.noreply.github.com>2020-08-31 09:57:29 +0200
committerRawi01 <Rawi01@users.noreply.github.com>2020-08-31 09:57:29 +0200
commit82ac8aad1d0e3e152db4ce328184c40c73700cee (patch)
tree3d5abb9072d43b87f19e5faf88a3d09b6c6da8e4 /src/utils/lombok/core
parent3d90a51163354930eeea0e26c2b0a567af8e96be (diff)
parent9148294f78a8e646ee131ca182a9b692bc028fdb (diff)
downloadlombok-82ac8aad1d0e3e152db4ce328184c40c73700cee.tar.gz
lombok-82ac8aad1d0e3e152db4ce328184c40c73700cee.tar.bz2
lombok-82ac8aad1d0e3e152db4ce328184c40c73700cee.zip
Merge branch 'master' into extensionmethod
Conflicts: build.xml
Diffstat (limited to 'src/utils/lombok/core')
-rw-r--r--src/utils/lombok/core/JavaIdentifiers.java11
-rw-r--r--src/utils/lombok/core/SpiLoadUtil.java4
2 files changed, 14 insertions, 1 deletions
diff --git a/src/utils/lombok/core/JavaIdentifiers.java b/src/utils/lombok/core/JavaIdentifiers.java
index cbe90eed..906ae0e1 100644
--- a/src/utils/lombok/core/JavaIdentifiers.java
+++ b/src/utils/lombok/core/JavaIdentifiers.java
@@ -21,6 +21,8 @@
*/
package lombok.core;
+import java.util.regex.Pattern;
+
/**
* Utility functions for validating potential java verifiers.
*/
@@ -54,4 +56,13 @@ public class JavaIdentifiers {
public static boolean isKeyword(String keyword) {
return KEYWORDS.contains(keyword);
}
+
+ /** Matches any of the 8 primitive names, such as {@code boolean}. */
+ private static final Pattern PRIMITIVE_TYPE_NAME_PATTERN = Pattern.compile("^(?:boolean|byte|short|int|long|float|double|char)$");
+
+ public static boolean isPrimitive(String typeName) {
+ return PRIMITIVE_TYPE_NAME_PATTERN.matcher(typeName).matches();
+ }
+
+
}
diff --git a/src/utils/lombok/core/SpiLoadUtil.java b/src/utils/lombok/core/SpiLoadUtil.java
index e685acd6..0feb7f12 100644
--- a/src/utils/lombok/core/SpiLoadUtil.java
+++ b/src/utils/lombok/core/SpiLoadUtil.java
@@ -129,9 +129,10 @@ public class SpiLoadUtil {
private static void readServicesFromUrl(Collection<String> list, URL url) throws IOException {
InputStream in = url.openStream();
+ BufferedReader r = null;
try {
if (in == null) return;
- BufferedReader r = new BufferedReader(new InputStreamReader(in, "UTF-8"));
+ r = new BufferedReader(new InputStreamReader(in, "UTF-8"));
while (true) {
String line = r.readLine();
if (line == null) break;
@@ -143,6 +144,7 @@ public class SpiLoadUtil {
}
} finally {
try {
+ if (r != null) r.close();
if (in != null) in.close();
} catch (Throwable ignore) {}
}