[refactor] Fixed a typo in a local var name, and utility-method-ified it to then make that typo a moot point.

This commit is contained in:
Reinier Zwitserloot committed 2025-03-07 00:20:19 +01:00
1 parent e29f9a4b52
commit 1fea6e7cfb
2 files changed
+13 -12

No files matched your search

+3 -11
View File
@@ -22,7 +22,7 @@
package lombok.javac;
import static lombok.javac.JavacTreeMaker.TreeTag.treeTag;
import static lombok.javac.JavacTreeMaker.TypeTag.typeTag;
import static lombok.javac.JavacTreeMaker.TypeTag.*;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
@@ -184,16 +184,8 @@ public class Javac {
public static final TypeTag CTC_NONE = typeTag("NONE");
public static final TypeTag CTC_BOT = typeTag("BOT");
public static final TypeTag CTC_ERROR = typeTag("ERROR");
public static final TypeTag CTC_UNKNOWN; // Removed in JDK24
static {
TypeTag unknonwTypeTag = null;
try {
unknonwTypeTag = typeTag("UNKNOWN");
} catch (Exception e) {
if (!(e instanceof NoSuchFieldException)) throw Javac.sneakyThrow(e);
}
CTC_UNKNOWN = unknonwTypeTag;
}
public static final TypeTag CTC_UNKNOWN = typeTagPermissive("UNKNOWN"); // UNKNOWN has been removed in JDK24, hence, we need to look it up permissively (just make it `null` if it does not exist).
public static final TypeTag CTC_UNDETVAR = typeTag("UNDETVAR");
public static final TypeTag CTC_CLASS = typeTag("CLASS");
+10 -1
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2013-2020 The Project Lombok Authors.
* Copyright (C) 2013-2025 The Project Lombok Authors.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -258,6 +258,15 @@ public class JavacTreeMaker {
public static TypeTag typeTag(String identifier) {
return new TypeTag(getFieldCached(TYPE_TAG_CACHE, Javac.getJavaCompilerVersion() < 8 ? "com.sun.tools.javac.code.TypeTags" : "com.sun.tools.javac.code.TypeTag", identifier));
}
public static TypeTag typeTagPermissive(String identifier) {
try {
return typeTag(identifier);
} catch (Exception e) {
if (e instanceof NoSuchFieldException) return null;
throw Javac.sneakyThrow(e);
}
}
}
public static class TreeTag extends SchroedingerType {