Skip to content

Commit

Permalink
migrate to the maintained javapoet project
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-manes committed Jan 11, 2025
1 parent bbf54be commit 3ff2445
Show file tree
Hide file tree
Showing 27 changed files with 76 additions and 76 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@
import com.google.common.collect.Iterables;
import com.google.common.collect.Sets;
import com.google.common.io.Resources;
import com.squareup.javapoet.ClassName;
import com.squareup.javapoet.JavaFile;
import com.squareup.javapoet.ParameterizedTypeName;
import com.squareup.javapoet.TypeName;
import com.squareup.javapoet.TypeSpec;
import com.palantir.javapoet.ClassName;
import com.palantir.javapoet.JavaFile;
import com.palantir.javapoet.ParameterizedTypeName;
import com.palantir.javapoet.TypeName;
import com.palantir.javapoet.TypeSpec;

/**
* Generates a factory that creates the cache optimized for the user specified configuration.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@
import com.google.common.collect.Iterables;
import com.google.common.collect.Sets;
import com.google.common.io.Resources;
import com.squareup.javapoet.ClassName;
import com.squareup.javapoet.JavaFile;
import com.squareup.javapoet.ParameterizedTypeName;
import com.squareup.javapoet.TypeName;
import com.squareup.javapoet.TypeSpec;
import com.palantir.javapoet.ClassName;
import com.palantir.javapoet.JavaFile;
import com.palantir.javapoet.ParameterizedTypeName;
import com.palantir.javapoet.TypeName;
import com.palantir.javapoet.TypeSpec;

/**
* Generates the cache entry's specialized type. These entries are optimized for the configuration
Expand Down Expand Up @@ -171,7 +171,7 @@ private TypeSpec makeNodeSpec(String className, boolean isFinal, ImmutableSet<Fe
if (features.size() == 2) {
parentFeatures = ImmutableSet.of();
generateFeatures = features;
superClass = TypeName.OBJECT;
superClass = ClassName.OBJECT;
} else {
// Requires that parentFeatures is in featureByIndex order for super class naming
parentFeatures = ImmutableSet.copyOf(Iterables.limit(features, features.size() - 1));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@

import org.jspecify.annotations.Nullable;

import com.squareup.javapoet.ClassName;
import com.squareup.javapoet.ParameterSpec;
import com.squareup.javapoet.ParameterizedTypeName;
import com.squareup.javapoet.TypeName;
import com.squareup.javapoet.TypeVariableName;
import com.palantir.javapoet.ClassName;
import com.palantir.javapoet.ParameterSpec;
import com.palantir.javapoet.ParameterizedTypeName;
import com.palantir.javapoet.TypeName;
import com.palantir.javapoet.TypeVariableName;

/**
* Shared constants for a code generation specification.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

import javax.lang.model.element.Modifier;

import com.squareup.javapoet.FieldSpec;
import com.palantir.javapoet.FieldSpec;

/**
* Adds the constructor to the cache.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
import javax.lang.model.element.Modifier;

import com.github.benmanes.caffeine.cache.Feature;
import com.squareup.javapoet.FieldSpec;
import com.squareup.javapoet.MethodSpec;
import com.squareup.javapoet.TypeName;
import com.palantir.javapoet.FieldSpec;
import com.palantir.javapoet.MethodSpec;
import com.palantir.javapoet.TypeName;

/**
* @author [email protected] (Ben Manes)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
import javax.lang.model.element.Modifier;

import com.github.benmanes.caffeine.cache.Feature;
import com.squareup.javapoet.FieldSpec;
import com.squareup.javapoet.MethodSpec;
import com.palantir.javapoet.FieldSpec;
import com.palantir.javapoet.MethodSpec;

/**
* @author [email protected] (Ben Manes)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
import javax.lang.model.element.Modifier;

import com.github.benmanes.caffeine.cache.Feature;
import com.squareup.javapoet.FieldSpec;
import com.squareup.javapoet.MethodSpec;
import com.palantir.javapoet.FieldSpec;
import com.palantir.javapoet.MethodSpec;

/**
* @author [email protected] (Ben Manes)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
import javax.lang.model.element.Modifier;

import com.github.benmanes.caffeine.cache.Feature;
import com.squareup.javapoet.FieldSpec;
import com.squareup.javapoet.MethodSpec;
import com.palantir.javapoet.FieldSpec;
import com.palantir.javapoet.MethodSpec;

/**
* @author [email protected] (Ben Manes)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import com.github.benmanes.caffeine.cache.Feature;
import com.google.common.collect.Sets;
import com.squareup.javapoet.MethodSpec;
import com.palantir.javapoet.MethodSpec;

/**
* @author [email protected] (Ben Manes)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
import javax.lang.model.element.Modifier;

import com.github.benmanes.caffeine.cache.Feature;
import com.squareup.javapoet.FieldSpec;
import com.squareup.javapoet.MethodSpec;
import com.squareup.javapoet.TypeName;
import com.palantir.javapoet.FieldSpec;
import com.palantir.javapoet.MethodSpec;
import com.palantir.javapoet.TypeName;

/**
* @author [email protected] (Ben Manes)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
import javax.lang.model.element.Modifier;

import com.github.benmanes.caffeine.cache.Feature;
import com.squareup.javapoet.CodeBlock;
import com.squareup.javapoet.FieldSpec;
import com.squareup.javapoet.MethodSpec;
import com.palantir.javapoet.CodeBlock;
import com.palantir.javapoet.FieldSpec;
import com.palantir.javapoet.MethodSpec;

/**
* @author [email protected] (Ben Manes)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
import javax.lang.model.element.Modifier;

import com.github.benmanes.caffeine.cache.Feature;
import com.squareup.javapoet.FieldSpec;
import com.squareup.javapoet.MethodSpec;
import com.palantir.javapoet.FieldSpec;
import com.palantir.javapoet.MethodSpec;

/**
* @author [email protected] (Ben Manes)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
import javax.lang.model.element.Modifier;

import com.github.benmanes.caffeine.cache.Feature;
import com.squareup.javapoet.FieldSpec;
import com.squareup.javapoet.MethodSpec;
import com.palantir.javapoet.FieldSpec;
import com.palantir.javapoet.MethodSpec;

/**
* @author [email protected] (Ben Manes)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
import javax.lang.model.element.Modifier;

import com.github.benmanes.caffeine.cache.Feature;
import com.squareup.javapoet.FieldSpec;
import com.squareup.javapoet.MethodSpec;
import com.palantir.javapoet.FieldSpec;
import com.palantir.javapoet.MethodSpec;

/**
* @author [email protected] (Ben Manes)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
import javax.lang.model.element.Modifier;

import com.github.benmanes.caffeine.cache.Feature;
import com.squareup.javapoet.FieldSpec;
import com.squareup.javapoet.MethodSpec;
import com.palantir.javapoet.FieldSpec;
import com.palantir.javapoet.MethodSpec;

/**
* @author [email protected] (Ben Manes)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import org.apache.commons.lang3.StringUtils;

import com.squareup.javapoet.AnnotationSpec;
import com.palantir.javapoet.AnnotationSpec;

/**
* @author [email protected] (Ben Manes)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
import com.github.benmanes.caffeine.cache.Feature;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
import com.squareup.javapoet.MethodSpec;
import com.squareup.javapoet.TypeName;
import com.squareup.javapoet.TypeSpec;
import com.palantir.javapoet.MethodSpec;
import com.palantir.javapoet.TypeName;
import com.palantir.javapoet.TypeSpec;

/**
* @author [email protected] (Ben Manes)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import static com.github.benmanes.caffeine.cache.Specifications.valueSpec;
import static com.github.benmanes.caffeine.cache.node.NodeContext.varHandleName;

import com.squareup.javapoet.MethodSpec;
import com.palantir.javapoet.MethodSpec;

/**
* Adds the constructors to the node.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
import com.github.benmanes.caffeine.cache.Feature;
import com.github.benmanes.caffeine.cache.node.NodeContext.Strength;
import com.github.benmanes.caffeine.cache.node.NodeContext.Visibility;
import com.squareup.javapoet.MethodSpec;
import com.squareup.javapoet.TypeName;
import com.palantir.javapoet.MethodSpec;
import com.palantir.javapoet.TypeName;

/**
* Adds the expiration support to the node.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@

import com.github.benmanes.caffeine.cache.Feature;
import com.google.common.collect.ImmutableList;
import com.squareup.javapoet.MethodSpec;
import com.squareup.javapoet.ParameterSpec;
import com.palantir.javapoet.MethodSpec;
import com.palantir.javapoet.ParameterSpec;

/**
* @author github.com/jvassev (Julian Vassev)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import static com.github.benmanes.caffeine.cache.node.NodeContext.varHandleName;

import com.github.benmanes.caffeine.cache.node.NodeContext.Strength;
import com.squareup.javapoet.MethodSpec;
import com.palantir.javapoet.MethodSpec;

/**
* Adds the health state to the node.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
import javax.lang.model.element.Modifier;

import com.github.benmanes.caffeine.cache.node.NodeContext.Visibility;
import com.squareup.javapoet.ClassName;
import com.squareup.javapoet.FieldSpec;
import com.squareup.javapoet.MethodSpec;
import com.palantir.javapoet.ClassName;
import com.palantir.javapoet.FieldSpec;
import com.palantir.javapoet.MethodSpec;

/**
* Adds the key to the node.
Expand Down Expand Up @@ -57,7 +57,7 @@ private static void addIfStrongValue(NodeContext context) {
.addMethod(context.newGetRef("key"));
context.addVarHandle("key", context.isStrongKeys()
? ClassName.get(Object.class)
: context.keyReferenceType().rawType);
: context.keyReferenceType().rawType());
}

private static void addIfCollectedValue(NodeContext context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
import com.github.benmanes.caffeine.cache.Feature;
import com.github.benmanes.caffeine.cache.node.NodeContext.Strength;
import com.github.benmanes.caffeine.cache.node.NodeContext.Visibility;
import com.squareup.javapoet.MethodSpec;
import com.squareup.javapoet.TypeName;
import com.palantir.javapoet.MethodSpec;
import com.palantir.javapoet.TypeName;

/**
* Adds the maximum metadata to the node.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
import javax.lang.model.element.Modifier;

import com.github.benmanes.caffeine.cache.node.NodeContext.Strength;
import com.squareup.javapoet.ClassName;
import com.squareup.javapoet.CodeBlock;
import com.squareup.javapoet.FieldSpec;
import com.squareup.javapoet.MethodSpec;
import com.palantir.javapoet.ClassName;
import com.palantir.javapoet.CodeBlock;
import com.palantir.javapoet.FieldSpec;
import com.palantir.javapoet.MethodSpec;

/**
* Adds the value to the node.
Expand All @@ -53,7 +53,7 @@ public void execute(NodeContext context) {
if (context.isStrongValues()) {
context.addVarHandle("value", ClassName.get(Object.class));
} else {
context.addVarHandle("value", context.valueReferenceType().rawType);
context.addVarHandle("value", context.valueReferenceType().rawType());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@

import org.apache.commons.lang3.StringUtils;

import com.squareup.javapoet.AnnotationSpec;
import com.squareup.javapoet.CodeBlock;
import com.palantir.javapoet.AnnotationSpec;
import com.palantir.javapoet.CodeBlock;

/**
* Finishes construction of the node.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@
import com.google.common.base.CaseFormat;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
import com.squareup.javapoet.ClassName;
import com.squareup.javapoet.CodeBlock;
import com.squareup.javapoet.FieldSpec;
import com.squareup.javapoet.MethodSpec;
import com.squareup.javapoet.ParameterizedTypeName;
import com.squareup.javapoet.TypeName;
import com.squareup.javapoet.TypeSpec;
import com.palantir.javapoet.ClassName;
import com.palantir.javapoet.CodeBlock;
import com.palantir.javapoet.FieldSpec;
import com.palantir.javapoet.MethodSpec;
import com.palantir.javapoet.ParameterizedTypeName;
import com.palantir.javapoet.TypeName;
import com.palantir.javapoet.TypeSpec;

/**
* @author [email protected] (Ben Manes)
Expand Down Expand Up @@ -90,7 +90,7 @@ public Modifier[] publicFinalModifiers() {
}

public boolean isBaseClass() {
return superClass.equals(TypeName.OBJECT);
return superClass.equals(ClassName.OBJECT);
}

public Strength keyStrength() {
Expand Down Expand Up @@ -132,7 +132,7 @@ public void addVarHandle(String varName, TypeName type) {
Modifier.PROTECTED, Modifier.STATIC, Modifier.FINAL).build());
Consumer<CodeBlock.Builder> statement = builder -> builder
.addStatement("$L = lookup.findVarHandle($T.class, $L.$L, $T.class)", fieldName,
ClassName.bestGuess(className), NODE_FACTORY.rawType.simpleName(),
ClassName.bestGuess(className), NODE_FACTORY.rawType().simpleName(),
fieldName, type);
varHandles.add(statement);
}
Expand Down
6 changes: 3 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jakarta-inject = "2.0.1"
jamm = "0.4.0"
java-object-layout = "0.17"
javax-inject = "1"
javapoet = "1.13.0"
javapoet = "0.6.0"
jazzer = "0.23.0"
jcache = "1.1.1"
jcommander = "1.82"
Expand Down Expand Up @@ -87,7 +87,7 @@ sigstore = "1.2.0"
sonarqube = "6.0.1.5171"
spotbugs = "4.8.6"
spotbugs-contrib = "7.6.9"
spotbugs-plugin = "6.0.27"
spotbugs-plugin = "6.1.0"
stream = "2.9.8"
tcache = "2.0.1"
testng = "7.10.2"
Expand Down Expand Up @@ -149,7 +149,7 @@ jacoco-ant = { module = "org.jacoco:org.jacoco.ant", version.ref = "jacoco" }
jakarta-inject = { module = "jakarta.inject:jakarta.inject-api", version.ref = "jakarta-inject" }
jamm = { module = "com.github.jbellis:jamm", version.ref = "jamm" }
java-object-layout = { module = "org.openjdk.jol:jol-cli", version.ref = "java-object-layout" }
javapoet = { module = "com.squareup:javapoet", version.ref = "javapoet" }
javapoet = { module = "com.palantir.javapoet:javapoet", version.ref = "javapoet" }
javax-inject = { module = "javax.inject:javax.inject", version.ref = "javax-inject" }
jazzer = { module = "com.code-intelligence:jazzer", version.ref = "jazzer" }
jazzer-junit = { module = "com.code-intelligence:jazzer-junit", version.ref = "jazzer" }
Expand Down

0 comments on commit 3ff2445

Please sign in to comment.