[build] sped up the build considerable.

We used to use the mango SPI processor, but this had two major issues:
* ecj wouldn't run annotation processors, requiring a separate proc:only compile run with javac
* mangoSPI couldn't do incremental compilation, so this required a full rebuild just to generate SPI files, every time.

Addressed by updating to IPP40 which does support explicit annotation processors even for ecj, and
adding our own SPI generating annotation processor to the build which can deal with incrementals.

There are some limits; removing a `@Provides` annotation on an existing type will need a full clean to pick that up, for example.
These limits seem quite exotic, though.
This commit is contained in:
Reinier Zwitserloot committed 2021-03-16 17:09:13 +01:00
1 parent a49aec582b
commit 476a43b970
97 files changed
+935 -382

No files matched your search

+24 -40
View File
@@ -1,5 +1,5 @@
<!--
Copyright (C) 2020 The Project Lombok Authors.
Copyright (C) 2020-2021 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
@@ -50,7 +50,7 @@ This buildfile is part of projectlombok.org. It takes care of compiling and buil
<echo level="info">Lombok version: ${lombok.version} (${lombok.fullversion})</echo>
</target>
<property name="packing.basedirs" value="build/lombok-transplants,build/lombok-utils,build/lombok-utils6,build/lombok-main,build/lombok-main8,build/lombok-meta,build/lombok-deps" />
<property name="packing.basedirs" value="build/lombok-transplants,build/lombok-utils,build/lombok-utils6,build/lombok-main,build/lombok-main8,build/lombok-deps" />
<loadresource property="packing.basedirs.colon">
<propertyresource name="packing.basedirs" />
<filterchain><tokenfilter>
@@ -62,21 +62,31 @@ This buildfile is part of projectlombok.org. It takes care of compiling and buil
<pathelement path="${packing.basedirs.colon}" />
</path>
<target name="compile" depends="version, deps, -setup.build" description="Compiles the code">
<target name="-compile.spiProcessor" depends="version, -setup.build" description="Compiles the services file generating processor">
<ivy:compile destdir="build/spiProcessor" source="1.8" target="1.8" ecj="true">
<src path="src/spiProcessor" />
<classpath location="build/spiProcessor" />
</ivy:compile>
<mkdir dir="build/spiProcessor/META-INF/services" />
<echo file="build/spiProcessor/META-INF/services/javax.annotation.processing.Processor">lombok.spi.SpiProcessor</echo>
<jar destfile="build/spiProcessor.jar">
<fileset dir="build/spiProcessor" />
</jar>
</target>
<target name="compile" depends="version, deps, -setup.build, -compile.spiProcessor" description="Compiles the code">
<!--
1. Compile stubs.
2. Compile transplants.
3. Compile lombok-utils.
4. Compile lombok.
5. Run SPI processor.
6. Create other manifest entries. -->
4. Compile lombok. -->
<!--
ant includes the destination dir on the classpath (and there are good reasons to do this), but that also means
the bleeding edge lombok from the previous build is run (as lombok is an annotation processor), which means if
there are bugs in it, you can't compile anymore until you 'ant clean'. That's very undesirable. so we kill the processor,
which stops lombok from running. We re-create the file at the end of this target. -->
<delete file="build/lombok-meta/META-INF/services/javax.annotation.processing.Processor" quiet="true" />
<delete file="build/lombok-main/META-INF/services/javax.annotation.processing.Processor" quiet="true" />
<!--
first, compile stubs. Lombok needs to produce class files that run in a wide variety of JDK, javac, and ecj/eclipse versions.
@@ -162,7 +172,8 @@ This buildfile is part of projectlombok.org. It takes care of compiling and buil
<classpath refid="cp.build" />
<classpath refid="cp.eclipse-oxygen" />
<classpath refid="cp.javac6" />
<classpath path="build/lombok-utils:build/lombok-utils6:build/lombok-main" />
<classpath path="build/lombok-utils:build/lombok-utils6:build/lombok-main:build/spiProcessor.jar" />
<annotationProcessor jar="build/spiProcessor.jar" processor="lombok.spi.SpiProcessor" />
</ivy:compile>
<!-- This is really part of the eclipse agent, but references lombok, so that had to be compiled first -->
@@ -183,7 +194,7 @@ This buildfile is part of projectlombok.org. It takes care of compiling and buil
<bootclasspath location="build/stubs" />
<src path="src/core8" />
<classpath refid="cp.javac8" />
<classpath path="build/lombok-main:build/lombok-main8" />
<classpath path="build/lombok-main:build/lombok-main8:build" />
</ivy:compile>
<!--
@@ -195,37 +206,11 @@ This buildfile is part of projectlombok.org. It takes care of compiling and buil
<classpath refid="cp.build" />
</ivy:compile>
<!-- Run the SPI processor to create the services files listing all lombok handlers -->
<delete dir="build/lombok-proc-result" quiet="true" />
<ivy:compile destdir="build/lombok-proc-result" release="9" nowarn="true">
<classpath location="build/stubs" />
<compilerarg value="-proc:only" />
<compilerarg value="-processor" />
<compilerarg value="org.mangosdk.spi.processor.SpiProcessor" />
<src path="src/core" />
<src path="src/installer" />
<src path="src/eclipseAgent" />
<src path="src/delombok" />
<classpath refid="cp.build" />
<classpath refid="cp.javac6" />
<classpath refid="cp.eclipse-oxygen" />
<classpath path="build/lombok-utils:build/lombok-utils6:build/lombok-main" />
</ivy:compile>
<mkdir dir="build/lombok-meta" />
<copy todir="build/lombok-meta">
<fileset dir="build/lombok-proc-result">
<include name="META-INF/services/*" />
</fileset>
</copy>
<mkdir dir="build/lombok-meta/META-INF" />
<mkdir dir="build/lombok-meta/META-INF/services" />
<echo file="build/lombok-meta/META-INF/services/javax.annotation.processing.Processor">lombok.launch.AnnotationProcessorHider$AnnotationProcessor
<mkdir dir="build/lombok-main/META-INF/services" />
<echo file="build/lombok-main/META-INF/services/javax.annotation.processing.Processor">lombok.launch.AnnotationProcessorHider$AnnotationProcessor
lombok.launch.AnnotationProcessorHider$ClaimingProcessor</echo>
<mkdir dir="build/lombok-meta/META-INF/gradle" />
<echo file="build/lombok-meta/META-INF/gradle/incremental.annotation.processors">lombok.launch.AnnotationProcessorHider$AnnotationProcessor,isolating
<mkdir dir="build/lombok-main/META-INF/gradle" />
<echo file="build/lombok-main/META-INF/gradle/incremental.annotation.processors">lombok.launch.AnnotationProcessorHider$AnnotationProcessor,isolating
lombok.launch.AnnotationProcessorHider$ClaimingProcessor,isolating</echo>
</target>
@@ -272,7 +257,6 @@ lombok.launch.AnnotationProcessorHider$ClaimingProcessor,isolating</echo>
</patternset>
<fileset dir="build/lombok-main"><patternset refid="packing.entrypoints" /></fileset>
<fileset dir="build/lombok-meta"><patternset refid="packing.entrypoints" /></fileset>
<!-- now include everything else but renamed for the shadowloader system, to make these classes invisible to other projects. -->
<patternset id="packing.shadowed">
+2 -1
View File
@@ -1,5 +1,5 @@
<!--
Copyright (C) 2010-2020 The Project Lombok Authors.
Copyright (C) 2010-2021 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
@@ -28,6 +28,7 @@ This buildfile is part of projectlombok.org. It creates the infrastructure neede
<target name="eclipse.projectfiles" depends="deps">
<ivy:eclipsegen source="1.6" srcout="bin/main">
<srcdir dir="src/spiProcessor" />
<srcdir dir="src/core" />
<srcdir dir="src/core8" />
<srcdir dir="src/launch" />
-1
View File
@@ -38,7 +38,6 @@
<dependency org="org.projectlombok" name="lombok.patcher" rev="0.40" conf="build,stripe->default" />
<dependency org="zwitserloot.com" name="cmdreader" rev="1.2" conf="build,stripe->runtime" />
<dependency org="projectlombok.org" name="spi" rev="0.2.7" conf="build" />
<dependency org="org.apache.ant" name="ant" rev="1.10.5" conf="build->default" />
<!-- test deps -->
+2 -2
View File
@@ -1,5 +1,5 @@
<!--
Copyright (C) 2020 The Project Lombok Authors.
Copyright (C) 2020-2021 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
@@ -140,7 +140,7 @@ This buildfile is part of projectlombok.org. It sets up the build itself.
<target name="-ipp.load" depends="-ipp.download">
<taskdef classpath="lib/ivyplusplus.jar" resource="com/zwitserloot/ivyplusplus/antlib.xml" uri="antlib:com.zwitserloot.ivyplusplus" />
<ivy:ensureippversion version="1.38" property="ivyplusplus.minimumAvailable" />
<ivy:ensureippversion version="1.40" property="ivyplusplus.minimumAvailable" />
</target>
<target name="-ipp.redownload" unless="ivyplusplus.minimumAvailable">
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2012 The Project Lombok Authors.
* Copyright (C) 2012-2021 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
@@ -26,8 +26,7 @@ import java.util.ArrayList;
import java.util.List;
import lombok.core.LombokApp;
import org.mangosdk.spi.ProviderFor;
import lombok.spi.Provides;
import com.zwitserloot.cmdreader.CmdReader;
import com.zwitserloot.cmdreader.Description;
@@ -36,9 +35,8 @@ import com.zwitserloot.cmdreader.Mandatory;
import com.zwitserloot.cmdreader.Sequential;
import com.zwitserloot.cmdreader.Shorthand;
@ProviderFor(LombokApp.class)
@Provides
public class PoolConstantsApp extends LombokApp {
@Override public String getAppName() {
return "Xprintpool";
}
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2010 The Project Lombok Authors.
* Copyright (C) 2010-2021 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
@@ -33,8 +33,7 @@ import java.util.List;
import lombok.core.DiagnosticsReceiver;
import lombok.core.LombokApp;
import lombok.core.PostCompiler;
import org.mangosdk.spi.ProviderFor;
import lombok.spi.Provides;
import com.zwitserloot.cmdreader.CmdReader;
import com.zwitserloot.cmdreader.Description;
@@ -43,7 +42,7 @@ import com.zwitserloot.cmdreader.Mandatory;
import com.zwitserloot.cmdreader.Sequential;
import com.zwitserloot.cmdreader.Shorthand;
@ProviderFor(LombokApp.class)
@Provides
public class PostCompilerApp extends LombokApp {
@Override public List<String> getAppAliases() {
return Arrays.asList("post", "postcompile");
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2010-2014 The Project Lombok Authors.
* Copyright (C) 2010-2021 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
@@ -27,15 +27,15 @@ import java.util.concurrent.atomic.AtomicBoolean;
import lombok.core.DiagnosticsReceiver;
import lombok.core.PostCompilerTransformation;
import lombok.spi.Provides;
import org.mangosdk.spi.ProviderFor;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
@ProviderFor(PostCompilerTransformation.class)
@Provides
public class PreventNullAnalysisRemover implements PostCompilerTransformation {
@Override public byte[] applyTransformations(byte[] original, String fileName, DiagnosticsReceiver diagnostics) {
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2010-2014 The Project Lombok Authors.
* Copyright (C) 2010-2021 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
@@ -27,8 +27,8 @@ import java.util.concurrent.atomic.AtomicBoolean;
import lombok.core.DiagnosticsReceiver;
import lombok.core.PostCompilerTransformation;
import lombok.spi.Provides;
import org.mangosdk.spi.ProviderFor;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
@@ -37,7 +37,7 @@ import org.objectweb.asm.Label;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
@ProviderFor(PostCompilerTransformation.class)
@Provides
public class SneakyThrowsRemover implements PostCompilerTransformation {
@Override public byte[] applyTransformations(byte[] original, String fileName, final DiagnosticsReceiver diagnostics) {
+4 -4
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2009-2018 The Project Lombok Authors.
* Copyright (C) 2009-2021 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
@@ -30,7 +30,7 @@ import java.util.Collection;
import java.util.Collections;
import java.util.List;
import org.mangosdk.spi.ProviderFor;
import lombok.spi.Provides;
public class Main {
private static final Collection<?> HELP_SWITCHES = Collections.unmodifiableList(Arrays.asList(
@@ -46,7 +46,7 @@ public class Main {
}
}
@ProviderFor(LombokApp.class)
@Provides
public static class VersionApp extends LombokApp {
@Override public String getAppName() {
return "version";
@@ -66,7 +66,7 @@ public class Main {
}
}
@ProviderFor(LombokApp.class)
@Provides
public static class LicenseApp extends LombokApp {
@Override public String getAppName() {
return "license";
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2012 The Project Lombok Authors.
* Copyright (C) 2012-2021 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
@@ -36,10 +36,9 @@ import java.util.zip.ZipEntry;
import lombok.Lombok;
import lombok.patcher.ClassRootFinder;
import lombok.spi.Provides;
import org.mangosdk.spi.ProviderFor;
@ProviderFor(LombokApp.class)
@Provides
public class PublicApiCreatorApp extends LombokApp {
@Override public String getAppName() {
return "publicApi";
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2014-2020 The Project Lombok Authors.
* Copyright (C) 2014-2021 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
@@ -41,8 +41,6 @@ import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;
import org.mangosdk.spi.ProviderFor;
import com.zwitserloot.cmdreader.CmdReader;
import com.zwitserloot.cmdreader.Description;
import com.zwitserloot.cmdreader.Excludes;
@@ -56,8 +54,9 @@ import com.zwitserloot.cmdreader.Shorthand;
import lombok.ConfigurationKeys;
import lombok.core.LombokApp;
import lombok.core.configuration.ConfigurationParser.Collector;
import lombok.spi.Provides;
@ProviderFor(LombokApp.class)
@Provides
public class ConfigurationApp extends LombokApp {
private static final URI NO_CONFIG = URI.create("");
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2009-2010 The Project Lombok Authors.
* Copyright (C) 2009-2021 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
@@ -25,10 +25,9 @@ import java.util.Arrays;
import java.util.List;
import lombok.core.runtimeDependencies.RuntimeDependencyInfo;
import lombok.spi.Provides;
import org.mangosdk.spi.ProviderFor;
@ProviderFor(RuntimeDependencyInfo.class)
@Provides
public class SneakyThrowsAndCleanupDependencyInfo implements RuntimeDependencyInfo {
@Override public List<String> getRuntimeDependencies() {
return Arrays.asList(
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2009-2011 The Project Lombok Authors.
* Copyright (C) 2009-2021 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
@@ -38,8 +38,7 @@ import java.util.zip.ZipEntry;
import lombok.core.LombokApp;
import lombok.core.SpiLoadUtil;
import org.mangosdk.spi.ProviderFor;
import lombok.spi.Provides;
import com.zwitserloot.cmdreader.CmdReader;
import com.zwitserloot.cmdreader.Description;
@@ -48,7 +47,7 @@ import com.zwitserloot.cmdreader.Mandatory;
import com.zwitserloot.cmdreader.Requires;
import com.zwitserloot.cmdreader.Shorthand;
@ProviderFor(LombokApp.class)
@Provides
public class CreateLombokRuntimeApp extends LombokApp {
private List<RuntimeDependencyInfo> infoObjects;
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2014 The Project Lombok Authors.
* Copyright (C) 2014-2021 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
@@ -28,11 +28,11 @@ import lombok.core.HandlerPriority;
import lombok.eclipse.EclipseAnnotationHandler;
import lombok.eclipse.EclipseNode;
import lombok.experimental.Accessors;
import lombok.spi.Provides;
import org.eclipse.jdt.internal.compiler.ast.Annotation;
import org.mangosdk.spi.ProviderFor;
@ProviderFor(EclipseAnnotationHandler.class)
@Provides
@HandlerPriority(65536)
public class HandleAccessors extends EclipseAnnotationHandler<Accessors> {
@Override public void handle(AnnotationValues<Accessors> annotation, Annotation ast, EclipseNode annotationNode) {
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2013-2020 The Project Lombok Authors.
* Copyright (C) 2013-2021 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
@@ -74,7 +74,6 @@ import org.eclipse.jdt.internal.compiler.lookup.ClassScope;
import org.eclipse.jdt.internal.compiler.lookup.MethodScope;
import org.eclipse.jdt.internal.compiler.lookup.TypeConstants;
import org.eclipse.jdt.internal.compiler.lookup.TypeIds;
import org.mangosdk.spi.ProviderFor;
import lombok.AccessLevel;
import lombok.Builder;
@@ -98,8 +97,9 @@ import lombok.eclipse.handlers.EclipseSingularsRecipes.EclipseSingularizer;
import lombok.eclipse.handlers.EclipseSingularsRecipes.SingularData;
import lombok.eclipse.handlers.HandleConstructor.SkipIfConstructorExists;
import lombok.experimental.NonFinal;
import lombok.spi.Provides;
@ProviderFor(EclipseAnnotationHandler.class)
@Provides
@HandlerPriority(-1024) //-2^10; to ensure we've picked up @FieldDefault's changes (-2048) but @Value hasn't removed itself yet (-512), so that we can error on presence of it on the builder classes.
public class HandleBuilder extends EclipseAnnotationHandler<Builder> {
private HandleConstructor handleConstructor = new HandleConstructor();
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2018 The Project Lombok Authors.
* Copyright (C) 2017-2021 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
@@ -23,7 +23,6 @@ package lombok.eclipse.handlers;
import static lombok.eclipse.handlers.EclipseHandlerUtil.*;
import org.eclipse.jdt.internal.compiler.ast.Annotation;
import org.mangosdk.spi.ProviderFor;
import lombok.Builder;
import lombok.core.AST.Kind;
@@ -32,8 +31,9 @@ import lombok.core.HandlerPriority;
import lombok.eclipse.EclipseAnnotationHandler;
import lombok.eclipse.EclipseNode;
import lombok.experimental.SuperBuilder;
import lombok.spi.Provides;
@ProviderFor(EclipseAnnotationHandler.class)
@Provides
@HandlerPriority(-1025) //HandleBuilder's level, minus one.
public class HandleBuilderDefault extends EclipseAnnotationHandler<Builder.Default> {
@Override public void handle(AnnotationValues<Builder.Default> annotation, Annotation ast, EclipseNode annotationNode) {
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2009-2014 The Project Lombok Authors.
* Copyright (C) 2009-2021 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
@@ -32,6 +32,7 @@ import lombok.core.AnnotationValues;
import lombok.core.AST.Kind;
import lombok.eclipse.EclipseAnnotationHandler;
import lombok.eclipse.EclipseNode;
import lombok.spi.Provides;
import org.eclipse.jdt.internal.compiler.ast.ASTNode;
import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
@@ -52,12 +53,11 @@ import org.eclipse.jdt.internal.compiler.ast.SingleNameReference;
import org.eclipse.jdt.internal.compiler.ast.Statement;
import org.eclipse.jdt.internal.compiler.ast.SwitchStatement;
import org.eclipse.jdt.internal.compiler.ast.TryStatement;
import org.mangosdk.spi.ProviderFor;
/**
* Handles the {@code lombok.Cleanup} annotation for eclipse.
*/
@ProviderFor(EclipseAnnotationHandler.class)
@Provides
public class HandleCleanup extends EclipseAnnotationHandler<Cleanup> {
public void handle(AnnotationValues<Cleanup> annotation, Annotation ast, EclipseNode annotationNode) {
handleFlagUsage(annotationNode, ConfigurationKeys.CLEANUP_FLAG_USAGE, "@Cleanup");
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2010-2020 The Project Lombok Authors.
* Copyright (C) 2010-2021 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
@@ -44,6 +44,7 @@ import lombok.core.AnnotationValues;
import lombok.eclipse.EclipseAnnotationHandler;
import lombok.eclipse.EclipseNode;
import lombok.eclipse.handlers.EclipseHandlerUtil.MemberExistsResult;
import lombok.spi.Provides;
import org.eclipse.jdt.internal.compiler.ast.ASTNode;
import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
@@ -79,10 +80,9 @@ import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
import org.eclipse.jdt.internal.compiler.ast.TypeReference;
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
import org.eclipse.jdt.internal.compiler.lookup.TypeConstants;
import org.mangosdk.spi.ProviderFor;
public class HandleConstructor {
@ProviderFor(EclipseAnnotationHandler.class)
@Provides
public static class HandleNoArgsConstructor extends EclipseAnnotationHandler<NoArgsConstructor> {
private static final String NAME = NoArgsConstructor.class.getSimpleName();
private HandleConstructor handleConstructor = new HandleConstructor();
@@ -105,7 +105,7 @@ public class HandleConstructor {
}
}
@ProviderFor(EclipseAnnotationHandler.class)
@Provides
public static class HandleRequiredArgsConstructor extends EclipseAnnotationHandler<RequiredArgsConstructor> {
private static final String NAME = RequiredArgsConstructor.class.getSimpleName();
private HandleConstructor handleConstructor = new HandleConstructor();
@@ -166,7 +166,7 @@ public class HandleConstructor {
return fields;
}
@ProviderFor(EclipseAnnotationHandler.class)
@Provides
public static class HandleAllArgsConstructor extends EclipseAnnotationHandler<AllArgsConstructor> {
private static final String NAME = AllArgsConstructor.class.getSimpleName();
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2009-2014 The Project Lombok Authors.
* Copyright (C) 2009-2021 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
@@ -32,16 +32,16 @@ import lombok.core.AnnotationValues;
import lombok.eclipse.EclipseAnnotationHandler;
import lombok.eclipse.EclipseNode;
import lombok.eclipse.handlers.HandleConstructor.SkipIfConstructorExists;
import lombok.spi.Provides;
import org.eclipse.jdt.internal.compiler.ast.Annotation;
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
import org.mangosdk.spi.ProviderFor;
/**
* Handles the {@code lombok.Data} annotation for eclipse.
*/
@ProviderFor(EclipseAnnotationHandler.class)
@Provides
public class HandleData extends EclipseAnnotationHandler<Data> {
private HandleGetter handleGetter = new HandleGetter();
private HandleSetter handleSetter = new HandleSetter();
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2014 The Project Lombok Authors.
* Copyright (C) 2014-2021 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
@@ -27,14 +27,14 @@ import lombok.core.AnnotationValues;
import lombok.eclipse.EclipseAnnotationHandler;
import lombok.eclipse.EclipseNode;
import lombok.experimental.Delegate;
import lombok.spi.Provides;
import org.eclipse.jdt.internal.compiler.ast.Annotation;
import org.mangosdk.spi.ProviderFor;
/**
* This class just handles basic error cases. The real meat of eclipse '@Delegate' support is in {@code PatchDelegate}.
*/
@ProviderFor(EclipseAnnotationHandler.class)
@Provides
public class HandleDelegate extends EclipseAnnotationHandler<Delegate> {
public void handle(AnnotationValues<Delegate> annotation, Annotation ast, EclipseNode annotationNode) {
handleExperimentalFlagUsage(annotationNode, ConfigurationKeys.DELEGATE_FLAG_USAGE, "@Delegate");
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2009-2020 The Project Lombok Authors.
* Copyright (C) 2009-2021 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
@@ -48,6 +48,7 @@ import lombok.eclipse.Eclipse;
import lombok.eclipse.EclipseAnnotationHandler;
import lombok.eclipse.EclipseNode;
import lombok.eclipse.handlers.EclipseHandlerUtil.MemberExistsResult;
import lombok.spi.Provides;
import org.eclipse.jdt.internal.compiler.ast.ASTNode;
import org.eclipse.jdt.internal.compiler.ast.Annotation;
@@ -89,12 +90,11 @@ import org.eclipse.jdt.internal.compiler.ast.Wildcard;
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
import org.eclipse.jdt.internal.compiler.lookup.TypeConstants;
import org.eclipse.jdt.internal.compiler.lookup.TypeIds;
import org.mangosdk.spi.ProviderFor;
/**
* Handles the {@code EqualsAndHashCode} annotation for eclipse.
*/
@ProviderFor(EclipseAnnotationHandler.class)
@Provides
public class HandleEqualsAndHashCode extends EclipseAnnotationHandler<EqualsAndHashCode> {
private static final String HASH_CODE_CACHE_NAME = "$hashCodeCache";
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2012-2014 The Project Lombok Authors.
* Copyright (C) 2012-2021 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
@@ -28,7 +28,6 @@ import java.util.List;
import org.eclipse.jdt.internal.compiler.ast.Annotation;
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
import org.mangosdk.spi.ProviderFor;
import lombok.ConfigurationKeys;
import lombok.core.AnnotationValues;
@@ -36,9 +35,10 @@ import lombok.core.HandlerPriority;
import lombok.eclipse.EclipseAnnotationHandler;
import lombok.eclipse.EclipseNode;
import lombok.experimental.ExtensionMethod;
import lombok.spi.Provides;
// This handler just does some additional error checking; the real work is done in the agent.
@ProviderFor(EclipseAnnotationHandler.class)
@Provides
@HandlerPriority(66560) // 2^16 + 2^10; we must run AFTER HandleVal which is at 2^16
public class HandleExtensionMethod extends EclipseAnnotationHandler<ExtensionMethod> {
@Override public void handle(AnnotationValues<ExtensionMethod> annotation, Annotation ast, EclipseNode annotationNode) {
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2012-2016 The Project Lombok Authors.
* Copyright (C) 2012-2021 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
@@ -38,6 +38,7 @@ import lombok.eclipse.EclipseNode;
import lombok.experimental.FieldDefaults;
import lombok.experimental.NonFinal;
import lombok.experimental.PackagePrivate;
import lombok.spi.Provides;
import org.eclipse.jdt.internal.compiler.ast.ASTNode;
import org.eclipse.jdt.internal.compiler.ast.Annotation;
@@ -47,12 +48,11 @@ import org.eclipse.jdt.internal.compiler.ast.SingleTypeReference;
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
import org.eclipse.jdt.internal.compiler.ast.TypeReference;
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
import org.mangosdk.spi.ProviderFor;
/**
* Handles the {@code lombok.FieldDefaults} annotation for eclipse.
*/
@ProviderFor(EclipseASTVisitor.class)
@Provides(EclipseASTVisitor.class)
@HandlerPriority(-2048) //-2^11; to ensure @Value picks up on messing with the fields' 'final' state, run earlier.
public class HandleFieldDefaults extends EclipseASTAdapter {
public boolean generateFieldDefaultsForType(EclipseNode typeNode, EclipseNode pos, AccessLevel level, boolean makeFinal, boolean checkForTypeLevelFieldDefaults) {
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2014-2019 The Project Lombok Authors.
* Copyright (C) 2014-2021 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
@@ -41,7 +41,6 @@ import org.eclipse.jdt.internal.compiler.ast.StringLiteral;
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
import org.eclipse.jdt.internal.compiler.lookup.TypeConstants;
import org.mangosdk.spi.ProviderFor;
import lombok.AccessLevel;
import lombok.ConfigurationKeys;
@@ -54,8 +53,9 @@ import lombok.eclipse.EclipseAnnotationHandler;
import lombok.eclipse.EclipseNode;
import lombok.eclipse.handlers.EclipseHandlerUtil.MemberExistsResult;
import lombok.experimental.FieldNameConstants;
import lombok.spi.Provides;
@ProviderFor(EclipseAnnotationHandler.class)
@Provides
public class HandleFieldNameConstants extends EclipseAnnotationHandler<FieldNameConstants> {
private static final IdentifierName FIELDS = IdentifierName.valueOf("Fields");
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2009-2020 The Project Lombok Authors.
* Copyright (C) 2009-2021 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
@@ -35,6 +35,7 @@ import java.util.Map;
import lombok.AccessLevel;
import lombok.ConfigurationKeys;
import lombok.experimental.Delegate;
import lombok.spi.Provides;
import lombok.Getter;
import lombok.core.AST.Kind;
import lombok.core.AnnotationValues;
@@ -73,12 +74,11 @@ import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
import org.eclipse.jdt.internal.compiler.ast.TypeReference;
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
import org.eclipse.jdt.internal.compiler.lookup.TypeConstants;
import org.mangosdk.spi.ProviderFor;
/**
* Handles the {@code lombok.Getter} annotation for eclipse.
*/
@ProviderFor(EclipseAnnotationHandler.class)
@Provides
public class HandleGetter extends EclipseAnnotationHandler<Getter> {
private static final Annotation[] EMPTY_ANNOTATIONS_ARRAY = new Annotation[0];
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2015-2016 The Project Lombok Authors.
* Copyright (C) 2015-2021 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
@@ -45,7 +45,6 @@ import org.eclipse.jdt.internal.compiler.ast.ThisReference;
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
import org.mangosdk.spi.ProviderFor;
import lombok.ConfigurationKeys;
import lombok.core.AST.Kind;
@@ -53,11 +52,12 @@ import lombok.core.AnnotationValues;
import lombok.eclipse.EclipseAnnotationHandler;
import lombok.eclipse.EclipseNode;
import lombok.experimental.Helper;
import lombok.spi.Provides;
/**
* Handles the {@code lombok.Cleanup} annotation for eclipse.
*/
@ProviderFor(EclipseAnnotationHandler.class)
@Provides
public class HandleHelper extends EclipseAnnotationHandler<Helper> {
private Statement[] getStatementsFromAstNode(ASTNode node) {
if (node instanceof Block) return ((Block) node).statements;
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2013-2020 The Project Lombok Authors.
* Copyright (C) 2013-2021 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
@@ -37,7 +37,6 @@ import org.eclipse.jdt.internal.compiler.ast.StringLiteral;
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
import org.eclipse.jdt.internal.compiler.ast.TypeReference;
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
import org.mangosdk.spi.ProviderFor;
import lombok.Builder;
import lombok.ConfigurationKeys;
@@ -50,13 +49,15 @@ import lombok.eclipse.EclipseAnnotationHandler;
import lombok.eclipse.EclipseNode;
import lombok.experimental.SuperBuilder;
import lombok.extern.jackson.Jacksonized;
import lombok.spi.Provides;
/**
* This (ecj) handler deals with {@code @Jacksonized} modifying the (already
* generated) {@code @Builder} or {@code @SuperBuilder} to conform to Jackson's
* needs for builders.
*/
@ProviderFor(EclipseAnnotationHandler.class) @HandlerPriority(-512) // Above Handle(Super)Builder's level (builders must be already generated).
@Provides
@HandlerPriority(-512) // Above Handle(Super)Builder's level (builders must be already generated).
public class HandleJacksonized extends EclipseAnnotationHandler<Jacksonized> {
private static final char[][] JSON_POJO_BUILDER_ANNOTATION = Eclipse.fromQualifiedName("com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder");
+11 -11
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2010-2019 The Project Lombok Authors.
* Copyright (C) 2010-2021 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
@@ -38,7 +38,6 @@ import org.eclipse.jdt.internal.compiler.ast.StringLiteral;
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
import org.eclipse.jdt.internal.compiler.ast.TypeReference;
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
import org.mangosdk.spi.ProviderFor;
import lombok.ConfigurationKeys;
import lombok.core.AnnotationValues;
@@ -49,6 +48,7 @@ import lombok.core.handlers.LoggingFramework;
import lombok.eclipse.EclipseAnnotationHandler;
import lombok.eclipse.EclipseNode;
import lombok.eclipse.handlers.EclipseHandlerUtil.MemberExistsResult;
import lombok.spi.Provides;
public class HandleLog {
private static final IdentifierName LOG = IdentifierName.valueOf("log");
@@ -203,7 +203,7 @@ public class HandleLog {
/**
* Handles the {@link lombok.extern.apachecommons.CommonsLog} annotation for Eclipse.
*/
@ProviderFor(EclipseAnnotationHandler.class)
@Provides
public static class HandleCommonsLog extends EclipseAnnotationHandler<lombok.extern.apachecommons.CommonsLog> {
@Override public void handle(AnnotationValues<lombok.extern.apachecommons.CommonsLog> annotation, Annotation source, EclipseNode annotationNode) {
handleFlagUsage(annotationNode, ConfigurationKeys.LOG_COMMONS_FLAG_USAGE, "@apachecommons.CommonsLog", ConfigurationKeys.LOG_ANY_FLAG_USAGE, "any @Log");
@@ -214,7 +214,7 @@ public class HandleLog {
/**
* Handles the {@link lombok.extern.java.Log} annotation for Eclipse.
*/
@ProviderFor(EclipseAnnotationHandler.class)
@Provides
public static class HandleJulLog extends EclipseAnnotationHandler<lombok.extern.java.Log> {
@Override public void handle(AnnotationValues<lombok.extern.java.Log> annotation, Annotation source, EclipseNode annotationNode) {
handleFlagUsage(annotationNode, ConfigurationKeys.LOG_JUL_FLAG_USAGE, "@java.Log", ConfigurationKeys.LOG_ANY_FLAG_USAGE, "any @Log");
@@ -225,7 +225,7 @@ public class HandleLog {
/**
* Handles the {@link lombok.extern.log4j.Log4j} annotation for Eclipse.
*/
@ProviderFor(EclipseAnnotationHandler.class)
@Provides
public static class HandleLog4jLog extends EclipseAnnotationHandler<lombok.extern.log4j.Log4j> {
@Override public void handle(AnnotationValues<lombok.extern.log4j.Log4j> annotation, Annotation source, EclipseNode annotationNode) {
handleFlagUsage(annotationNode, ConfigurationKeys.LOG_LOG4J_FLAG_USAGE, "@Log4j", ConfigurationKeys.LOG_ANY_FLAG_USAGE, "any @Log");
@@ -236,7 +236,7 @@ public class HandleLog {
/**
* Handles the {@link lombok.extern.log4j.Log4j2} annotation for Eclipse.
*/
@ProviderFor(EclipseAnnotationHandler.class)
@Provides
public static class HandleLog4j2Log extends EclipseAnnotationHandler<lombok.extern.log4j.Log4j2> {
@Override public void handle(AnnotationValues<lombok.extern.log4j.Log4j2> annotation, Annotation source, EclipseNode annotationNode) {
handleFlagUsage(annotationNode, ConfigurationKeys.LOG_LOG4J2_FLAG_USAGE, "@Log4j2", ConfigurationKeys.LOG_ANY_FLAG_USAGE, "any @Log");
@@ -247,7 +247,7 @@ public class HandleLog {
/**
* Handles the {@link lombok.extern.slf4j.Slf4j} annotation for Eclipse.
*/
@ProviderFor(EclipseAnnotationHandler.class)
@Provides
public static class HandleSlf4jLog extends EclipseAnnotationHandler<lombok.extern.slf4j.Slf4j> {
@Override public void handle(AnnotationValues<lombok.extern.slf4j.Slf4j> annotation, Annotation source, EclipseNode annotationNode) {
handleFlagUsage(annotationNode, ConfigurationKeys.LOG_SLF4J_FLAG_USAGE, "@Slf4j", ConfigurationKeys.LOG_ANY_FLAG_USAGE, "any @Log");
@@ -258,7 +258,7 @@ public class HandleLog {
/**
* Handles the {@link lombok.extern.slf4j.XSlf4j} annotation for Eclipse.
*/
@ProviderFor(EclipseAnnotationHandler.class)
@Provides
public static class HandleXSlf4jLog extends EclipseAnnotationHandler<lombok.extern.slf4j.XSlf4j> {
@Override public void handle(AnnotationValues<lombok.extern.slf4j.XSlf4j> annotation, Annotation source, EclipseNode annotationNode) {
handleFlagUsage(annotationNode, ConfigurationKeys.LOG_XSLF4J_FLAG_USAGE, "@XSlf4j", ConfigurationKeys.LOG_ANY_FLAG_USAGE, "any @Log");
@@ -269,7 +269,7 @@ public class HandleLog {
/**
* Handles the {@link lombok.extern.jbosslog.JBossLog} annotation for Eclipse.
*/
@ProviderFor(EclipseAnnotationHandler.class)
@Provides
public static class HandleJBossLog extends EclipseAnnotationHandler<lombok.extern.jbosslog.JBossLog> {
@Override public void handle(AnnotationValues<lombok.extern.jbosslog.JBossLog> annotation, Annotation source, EclipseNode annotationNode) {
handleFlagUsage(annotationNode, ConfigurationKeys.LOG_JBOSSLOG_FLAG_USAGE, "@JBossLog", ConfigurationKeys.LOG_ANY_FLAG_USAGE, "any @Log");
@@ -280,7 +280,7 @@ public class HandleLog {
/**
* Handles the {@link lombok.extern.flogger.Flogger} annotation for Eclipse.
*/
@ProviderFor(EclipseAnnotationHandler.class)
@Provides
public static class HandleFloggerLog extends EclipseAnnotationHandler<lombok.extern.flogger.Flogger> {
@Override public void handle(AnnotationValues<lombok.extern.flogger.Flogger> annotation, Annotation source, EclipseNode annotationNode) {
handleFlagUsage(annotationNode, ConfigurationKeys.LOG_FLOGGER_FLAG_USAGE, "@Flogger", ConfigurationKeys.LOG_ANY_FLAG_USAGE, "any @Log");
@@ -291,7 +291,7 @@ public class HandleLog {
/**
* Handles the {@link lombok.CustomLog} annotation for Eclipse.
*/
@ProviderFor(EclipseAnnotationHandler.class)
@Provides
public static class HandleCustomLog extends EclipseAnnotationHandler<lombok.CustomLog> {
@Override public void handle(AnnotationValues<lombok.CustomLog> annotation, Annotation source, EclipseNode annotationNode) {
handleFlagUsage(annotationNode, ConfigurationKeys.LOG_CUSTOM_FLAG_USAGE, "@CustomLog", ConfigurationKeys.LOG_ANY_FLAG_USAGE, "any @Log");
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2013-2019 The Project Lombok Authors.
* Copyright (C) 2013-2021 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
@@ -46,7 +46,6 @@ import org.eclipse.jdt.internal.compiler.ast.SynchronizedStatement;
import org.eclipse.jdt.internal.compiler.ast.ThrowStatement;
import org.eclipse.jdt.internal.compiler.ast.TryStatement;
import org.eclipse.jdt.internal.compiler.ast.TypeReference;
import org.mangosdk.spi.ProviderFor;
import lombok.ConfigurationKeys;
import lombok.NonNull;
@@ -57,9 +56,10 @@ import lombok.eclipse.DeferUntilPostDiet;
import lombok.eclipse.EclipseAST;
import lombok.eclipse.EclipseAnnotationHandler;
import lombok.eclipse.EclipseNode;
import lombok.spi.Provides;
@DeferUntilPostDiet
@ProviderFor(EclipseAnnotationHandler.class)
@Provides
@HandlerPriority(value = 512) // 2^9; onParameter=@__(@NonNull) has to run first.
public class HandleNonNull extends EclipseAnnotationHandler<NonNull> {
private static final char[] REQUIRE_NON_NULL = "requireNonNull".toCharArray();
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2009-2014 The Project Lombok Authors.
* Copyright (C) 2009-2021 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
@@ -26,7 +26,6 @@ import java.io.FileNotFoundException;
import java.io.PrintStream;
import org.eclipse.jdt.internal.compiler.ast.Annotation;
import org.mangosdk.spi.ProviderFor;
import lombok.Lombok;
import lombok.core.AnnotationValues;
@@ -36,11 +35,12 @@ import lombok.eclipse.DeferUntilPostDiet;
import lombok.eclipse.EclipseASTVisitor;
import lombok.eclipse.EclipseAnnotationHandler;
import lombok.eclipse.EclipseNode;
import lombok.spi.Provides;
/**
* Handles the {@code lombok.core.PrintAST} annotation for eclipse.
*/
@ProviderFor(EclipseAnnotationHandler.class)
@Provides
@DeferUntilPostDiet
@HandlerPriority(536870912) // 2^29; this handler is customarily run at the very end.
public class HandlePrintAST extends EclipseAnnotationHandler<PrintAST> {
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2009-2019 The Project Lombok Authors.
* Copyright (C) 2009-2021 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
@@ -38,6 +38,7 @@ import lombok.core.configuration.CheckerFrameworkVersion;
import lombok.core.AnnotationValues;
import lombok.eclipse.EclipseAnnotationHandler;
import lombok.eclipse.EclipseNode;
import lombok.spi.Provides;
import org.eclipse.jdt.internal.compiler.ast.ASTNode;
import org.eclipse.jdt.internal.compiler.ast.Annotation;
@@ -56,12 +57,11 @@ import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
import org.eclipse.jdt.internal.compiler.ast.TypeReference;
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
import org.eclipse.jdt.internal.compiler.lookup.TypeIds;
import org.mangosdk.spi.ProviderFor;
/**
* Handles the {@code lombok.Setter} annotation for eclipse.
*/
@ProviderFor(EclipseAnnotationHandler.class)
@Provides
public class HandleSetter extends EclipseAnnotationHandler<Setter> {
public boolean generateSetterForType(EclipseNode typeNode, EclipseNode pos, AccessLevel level, boolean checkForTypeLevelSetter, List<Annotation> onMethod, List<Annotation> onParam) {
if (checkForTypeLevelSetter) {
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2009-2014 The Project Lombok Authors.
* Copyright (C) 2009-2021 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
@@ -36,6 +36,7 @@ import lombok.core.HandlerPriority;
import lombok.eclipse.DeferUntilPostDiet;
import lombok.eclipse.EclipseAnnotationHandler;
import lombok.eclipse.EclipseNode;
import lombok.spi.Provides;
import org.eclipse.jdt.internal.compiler.ast.ASTNode;
import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
@@ -56,12 +57,11 @@ import org.eclipse.jdt.internal.compiler.ast.Statement;
import org.eclipse.jdt.internal.compiler.ast.ThrowStatement;
import org.eclipse.jdt.internal.compiler.ast.TryStatement;
import org.eclipse.jdt.internal.compiler.ast.TypeReference;
import org.mangosdk.spi.ProviderFor;
/**
* Handles the {@code lombok.HandleSneakyThrows} annotation for eclipse.
*/
@ProviderFor(EclipseAnnotationHandler.class)
@Provides
@DeferUntilPostDiet
@HandlerPriority(value = 1024) // 2^10; @NonNull must have run first, so that we wrap around the statements generated by it.
public class HandleSneakyThrows extends EclipseAnnotationHandler<SneakyThrows> {
@@ -75,7 +75,6 @@ import org.eclipse.jdt.internal.compiler.lookup.ExtraCompilerModifiers;
import org.eclipse.jdt.internal.compiler.lookup.MethodScope;
import org.eclipse.jdt.internal.compiler.lookup.TypeConstants;
import org.eclipse.jdt.internal.compiler.lookup.TypeIds;
import org.mangosdk.spi.ProviderFor;
import lombok.AccessLevel;
import lombok.Builder;
@@ -101,8 +100,9 @@ import lombok.eclipse.handlers.HandleBuilder.BuilderFieldData;
import lombok.eclipse.handlers.HandleBuilder.BuilderJob;
import lombok.experimental.NonFinal;
import lombok.experimental.SuperBuilder;
import lombok.spi.Provides;
@ProviderFor(EclipseAnnotationHandler.class)
@Provides
@HandlerPriority(-1024) //-2^10; to ensure we've picked up @FieldDefault's changes (-2048) but @Value hasn't removed itself yet (-512), so that we can error on presence of it on the builder classes.
public class HandleSuperBuilder extends EclipseAnnotationHandler<SuperBuilder> {
private static final char[] SELF_METHOD_NAME = "self".toCharArray();
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2009-2020 The Project Lombok Authors.
* Copyright (C) 2009-2021 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
@@ -36,6 +36,7 @@ import lombok.eclipse.DeferUntilPostDiet;
import lombok.eclipse.EclipseAnnotationHandler;
import lombok.eclipse.EclipseNode;
import lombok.eclipse.handlers.EclipseHandlerUtil.MemberExistsResult;
import lombok.spi.Provides;
import org.eclipse.jdt.internal.compiler.ast.Annotation;
import org.eclipse.jdt.internal.compiler.ast.ArrayAllocationExpression;
@@ -51,12 +52,11 @@ import org.eclipse.jdt.internal.compiler.ast.SynchronizedStatement;
import org.eclipse.jdt.internal.compiler.ast.ThisReference;
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
import org.eclipse.jdt.internal.compiler.lookup.TypeConstants;
import org.mangosdk.spi.ProviderFor;
/**
* Handles the {@code lombok.Synchronized} annotation for eclipse.
*/
@ProviderFor(EclipseAnnotationHandler.class)
@Provides
@DeferUntilPostDiet
@HandlerPriority(value = 1024) // 2^10; @NonNull must have run first, so that we wrap around the statements generated by it.
public class HandleSynchronized extends EclipseAnnotationHandler<Synchronized> {
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2009-2020 The Project Lombok Authors.
* Copyright (C) 2009-2021 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
@@ -52,7 +52,6 @@ import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
import org.eclipse.jdt.internal.compiler.ast.TypeReference;
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
import org.eclipse.jdt.internal.compiler.lookup.TypeConstants;
import org.mangosdk.spi.ProviderFor;
import lombok.AccessLevel;
import lombok.ConfigurationKeys;
@@ -67,11 +66,12 @@ import lombok.core.handlers.InclusionExclusionUtils.Included;
import lombok.eclipse.Eclipse;
import lombok.eclipse.EclipseAnnotationHandler;
import lombok.eclipse.EclipseNode;
import lombok.spi.Provides;
/**
* Handles the {@code ToString} annotation for eclipse.
*/
@ProviderFor(EclipseAnnotationHandler.class)
@Provides
public class HandleToString extends EclipseAnnotationHandler<ToString> {
public void handle(AnnotationValues<ToString> annotation, Annotation ast, EclipseNode annotationNode) {
handleFlagUsage(annotationNode, ConfigurationKeys.TO_STRING_FLAG_USAGE, "@ToString");
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2015-2020 The Project Lombok Authors.
* Copyright (C) 2015-2021 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
@@ -43,7 +43,6 @@ import org.eclipse.jdt.internal.compiler.ast.ThrowStatement;
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
import org.eclipse.jdt.internal.compiler.lookup.TypeConstants;
import org.mangosdk.spi.ProviderFor;
import lombok.ConfigurationKeys;
import lombok.core.AnnotationValues;
@@ -52,12 +51,13 @@ import lombok.core.AST.Kind;
import lombok.eclipse.EclipseAnnotationHandler;
import lombok.eclipse.EclipseNode;
import lombok.experimental.UtilityClass;
import lombok.spi.Provides;
/**
* Handles the {@code lombok.experimental.UtilityClass} annotation for eclipse.
*/
@Provides
@HandlerPriority(-4096) //-2^12; to ensure @FieldDefaults picks up on the 'static' we set here.
@ProviderFor(EclipseAnnotationHandler.class)
public class HandleUtilityClass extends EclipseAnnotationHandler<UtilityClass> {
@Override public void handle(AnnotationValues<UtilityClass> annotation, Annotation ast, EclipseNode annotationNode) {
handleFlagUsage(annotationNode, ConfigurationKeys.UTILITY_CLASS_FLAG_USAGE, "@UtilityClass");
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2010-2018 The Project Lombok Authors.
* Copyright (C) 2010-2021 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
@@ -31,6 +31,7 @@ import lombok.eclipse.DeferUntilPostDiet;
import lombok.eclipse.EclipseASTAdapter;
import lombok.eclipse.EclipseASTVisitor;
import lombok.eclipse.EclipseNode;
import lombok.spi.Provides;
import org.eclipse.jdt.internal.compiler.ast.ASTNode;
import org.eclipse.jdt.internal.compiler.ast.ArrayInitializer;
@@ -39,12 +40,11 @@ import org.eclipse.jdt.internal.compiler.ast.ForeachStatement;
import org.eclipse.jdt.internal.compiler.ast.LocalDeclaration;
import org.eclipse.jdt.internal.compiler.ast.NullLiteral;
import org.eclipse.jdt.internal.compiler.ast.TypeReference;
import org.mangosdk.spi.ProviderFor;
/*
* This class just handles 3 basic error cases. The real meat of eclipse 'val' support is in {@code PatchVal} and {@code PatchValEclipse}.
*/
@ProviderFor(EclipseASTVisitor.class)
@Provides(EclipseASTVisitor.class)
@DeferUntilPostDiet
@HandlerPriority(65536) // 2^16; resolution needs to work, so if the RHS expression is i.e. a call to a generated getter, we have to run after that getter has been generated.
public class HandleVal extends EclipseASTAdapter {
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2012-2014 The Project Lombok Authors.
* Copyright (C) 2012-2021 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
@@ -34,17 +34,17 @@ import lombok.eclipse.EclipseAnnotationHandler;
import lombok.eclipse.EclipseNode;
import lombok.eclipse.handlers.HandleConstructor.SkipIfConstructorExists;
import lombok.experimental.NonFinal;
import lombok.spi.Provides;
import lombok.Value;
import org.eclipse.jdt.internal.compiler.ast.Annotation;
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
import org.mangosdk.spi.ProviderFor;
/**
* Handles the {@code lombok.Value} annotation for eclipse.
*/
@ProviderFor(EclipseAnnotationHandler.class)
@Provides
@HandlerPriority(-512) //-2^9; to ensure @EqualsAndHashCode and such pick up on this handler making the class final and messing with the fields' access levels, run earlier.
public class HandleValue extends EclipseAnnotationHandler<Value> {
private HandleFieldDefaults handleFieldDefaults = new HandleFieldDefaults();
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2012-2020 The Project Lombok Authors.
* Copyright (C) 2012-2021 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
@@ -38,6 +38,7 @@ import lombok.core.configuration.CheckerFrameworkVersion;
import lombok.core.AnnotationValues;
import lombok.eclipse.EclipseAnnotationHandler;
import lombok.eclipse.EclipseNode;
import lombok.spi.Provides;
import org.eclipse.jdt.internal.compiler.ast.ASTNode;
import org.eclipse.jdt.internal.compiler.ast.AllocationExpression;
@@ -57,9 +58,8 @@ import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
import org.eclipse.jdt.internal.compiler.ast.TypeReference;
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
import org.eclipse.jdt.internal.compiler.lookup.ExtraCompilerModifiers;
import org.mangosdk.spi.ProviderFor;
@ProviderFor(EclipseAnnotationHandler.class)
@Provides
public class HandleWith extends EclipseAnnotationHandler<With> {
public boolean generateWithForType(EclipseNode typeNode, EclipseNode pos, AccessLevel level, boolean checkForTypeLevelWith) {
if (checkForTypeLevelWith) {
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020 The Project Lombok Authors.
* Copyright (C) 2020-2021 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
@@ -51,7 +51,6 @@ import org.eclipse.jdt.internal.compiler.ast.Wildcard;
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
import org.eclipse.jdt.internal.compiler.lookup.ExtraCompilerModifiers;
import org.eclipse.jdt.internal.compiler.lookup.TypeIds;
import org.mangosdk.spi.ProviderFor;
import lombok.AccessLevel;
import lombok.ConfigurationKeys;
@@ -63,8 +62,9 @@ import lombok.eclipse.Eclipse;
import lombok.eclipse.EclipseAnnotationHandler;
import lombok.eclipse.EclipseNode;
import lombok.experimental.WithBy;
import lombok.spi.Provides;
@ProviderFor(EclipseAnnotationHandler.class)
@Provides
public class HandleWithBy extends EclipseAnnotationHandler<WithBy> {
public boolean generateWithByForType(EclipseNode typeNode, EclipseNode pos, AccessLevel level, boolean checkForTypeLevelWithBy) {
if (checkForTypeLevelWithBy) {
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2015 The Project Lombok Authors.
* Copyright (C) 2015-2021 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
@@ -21,12 +21,11 @@
*/
package lombok.eclipse.handlers.singulars;
import org.mangosdk.spi.ProviderFor;
import lombok.core.LombokImmutableList;
import lombok.eclipse.handlers.EclipseSingularsRecipes.EclipseSingularizer;
import lombok.spi.Provides;
@ProviderFor(EclipseSingularizer.class)
@Provides(EclipseSingularizer.class)
public class EclipseGuavaMapSingularizer extends EclipseGuavaSingularizer {
// TODO cgcc.ImmutableMultimap, cgcc.ImmutableListMultimap, cgcc.ImmutableSetMultimap
// TODO cgcc.ImmutableClassToInstanceMap
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2015 The Project Lombok Authors.
* Copyright (C) 2015-2021 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
@@ -21,12 +21,11 @@
*/
package lombok.eclipse.handlers.singulars;
import org.mangosdk.spi.ProviderFor;
import lombok.core.LombokImmutableList;
import lombok.eclipse.handlers.EclipseSingularsRecipes.EclipseSingularizer;
import lombok.spi.Provides;
@ProviderFor(EclipseSingularizer.class)
@Provides(EclipseSingularizer.class)
public class EclipseGuavaSetListSingularizer extends EclipseGuavaSingularizer {
// TODO com.google.common.collect.ImmutableRangeSet
// TODO com.google.common.collect.ImmutableMultiset and com.google.common.collect.ImmutableSortedMultiset
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2015 The Project Lombok Authors.
* Copyright (C) 2015-2021 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
@@ -21,12 +21,11 @@
*/
package lombok.eclipse.handlers.singulars;
import org.mangosdk.spi.ProviderFor;
import lombok.core.LombokImmutableList;
import lombok.eclipse.handlers.EclipseSingularsRecipes.EclipseSingularizer;
import lombok.spi.Provides;
@ProviderFor(EclipseSingularizer.class)
@Provides(EclipseSingularizer.class)
public class EclipseGuavaTableSingularizer extends EclipseGuavaSingularizer {
private static final LombokImmutableList<String> SUFFIXES =
LombokImmutableList.of("rowKey", "columnKey", "value");
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2015-2019 The Project Lombok Authors.
* Copyright (C) 2015-2021 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
@@ -31,6 +31,7 @@ import lombok.eclipse.Eclipse;
import lombok.eclipse.EclipseNode;
import lombok.eclipse.handlers.EclipseSingularsRecipes.EclipseSingularizer;
import lombok.eclipse.handlers.EclipseSingularsRecipes.SingularData;
import lombok.spi.Provides;
import org.eclipse.jdt.internal.compiler.ast.AllocationExpression;
import org.eclipse.jdt.internal.compiler.ast.Assignment;
@@ -45,10 +46,8 @@ import org.eclipse.jdt.internal.compiler.ast.SingleNameReference;
import org.eclipse.jdt.internal.compiler.ast.Statement;
import org.eclipse.jdt.internal.compiler.ast.SwitchStatement;
import org.eclipse.jdt.internal.compiler.ast.TypeReference;
import org.mangosdk.spi.ProviderFor;
@ProviderFor(EclipseSingularizer.class)
@Provides(EclipseSingularizer.class)
public class EclipseJavaUtilListSingularizer extends EclipseJavaUtilListSetSingularizer {
@Override public LombokImmutableList<String> getSupportedTypes() {
return LombokImmutableList.of("java.util.List", "java.util.Collection", "java.lang.Iterable");
@@ -50,7 +50,6 @@ import org.eclipse.jdt.internal.compiler.ast.Statement;
import org.eclipse.jdt.internal.compiler.ast.ThisReference;
import org.eclipse.jdt.internal.compiler.ast.TypeReference;
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
import org.mangosdk.spi.ProviderFor;
import lombok.AccessLevel;
import lombok.core.LombokImmutableList;
@@ -62,8 +61,9 @@ import lombok.eclipse.handlers.EclipseSingularsRecipes.SingularData;
import lombok.eclipse.handlers.EclipseSingularsRecipes.StatementMaker;
import lombok.eclipse.handlers.EclipseSingularsRecipes.TypeReferenceMaker;
import lombok.eclipse.handlers.HandleNonNull;
import lombok.spi.Provides;
@ProviderFor(EclipseSingularizer.class)
@Provides(EclipseSingularizer.class)
public class EclipseJavaUtilMapSingularizer extends EclipseJavaUtilSingularizer {
@Override public LombokImmutableList<String> getSupportedTypes() {
return LombokImmutableList.of("java.util.Map", "java.util.SortedMap", "java.util.NavigableMap");
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2015-2019 The Project Lombok Authors.
* Copyright (C) 2015-2021 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
@@ -27,11 +27,11 @@ import lombok.core.LombokImmutableList;
import lombok.eclipse.EclipseNode;
import lombok.eclipse.handlers.EclipseSingularsRecipes.EclipseSingularizer;
import lombok.eclipse.handlers.EclipseSingularsRecipes.SingularData;
import lombok.spi.Provides;
import org.eclipse.jdt.internal.compiler.ast.Statement;
import org.mangosdk.spi.ProviderFor;
@ProviderFor(EclipseSingularizer.class)
@Provides(EclipseSingularizer.class)
public class EclipseJavaUtilSetSingularizer extends EclipseJavaUtilListSetSingularizer {
@Override public LombokImmutableList<String> getSupportedTypes() {
return LombokImmutableList.of("java.util.Set", "java.util.SortedSet", "java.util.NavigableSet");
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2012-2014 The Project Lombok Authors.
* Copyright (C) 2012-2021 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
@@ -24,8 +24,6 @@ package lombok.javac.handlers;
import static lombok.core.handlers.HandlerUtil.*;
import static lombok.javac.handlers.JavacHandlerUtil.*;
import org.mangosdk.spi.ProviderFor;
import com.sun.tools.javac.tree.JCTree.JCAnnotation;
import lombok.ConfigurationKeys;
@@ -34,8 +32,9 @@ import lombok.core.HandlerPriority;
import lombok.experimental.Accessors;
import lombok.javac.JavacAnnotationHandler;
import lombok.javac.JavacNode;
import lombok.spi.Provides;
@ProviderFor(JavacAnnotationHandler.class)
@Provides
@HandlerPriority(65536)
public class HandleAccessors extends JavacAnnotationHandler<Accessors> {
@Override public void handle(AnnotationValues<Accessors> annotation, JCAnnotation ast, JavacNode annotationNode) {
@@ -30,8 +30,6 @@ import java.util.ArrayList;
import javax.lang.model.element.Modifier;
import org.mangosdk.spi.ProviderFor;
import com.sun.tools.javac.code.Flags;
import com.sun.tools.javac.tree.JCTree;
import com.sun.tools.javac.tree.JCTree.JCAnnotation;
@@ -81,8 +79,9 @@ import lombok.javac.handlers.JavacHandlerUtil.CopyJavadoc;
import lombok.javac.handlers.JavacHandlerUtil.MemberExistsResult;
import lombok.javac.handlers.JavacSingularsRecipes.JavacSingularizer;
import lombok.javac.handlers.JavacSingularsRecipes.SingularData;
import lombok.spi.Provides;
@ProviderFor(JavacAnnotationHandler.class)
@Provides
@HandlerPriority(-1024) //-2^10; to ensure we've picked up @FieldDefault's changes (-2048) but @Value hasn't removed itself yet (-512), so that we can error on presence of it on the builder classes.
public class HandleBuilder extends JavacAnnotationHandler<Builder> {
private HandleConstructor handleConstructor = new HandleConstructor();
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2018 The Project Lombok Authors.
* Copyright (C) 2017-2021 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
@@ -23,8 +23,6 @@ package lombok.javac.handlers;
import static lombok.javac.handlers.JavacHandlerUtil.*;
import org.mangosdk.spi.ProviderFor;
import com.sun.tools.javac.tree.JCTree.JCAnnotation;
import com.sun.tools.javac.tree.JCTree.JCFieldAccess;
import com.sun.tools.javac.tree.JCTree.JCIdent;
@@ -36,8 +34,9 @@ import lombok.core.HandlerPriority;
import lombok.experimental.SuperBuilder;
import lombok.javac.JavacAnnotationHandler;
import lombok.javac.JavacNode;
import lombok.spi.Provides;
@ProviderFor(JavacAnnotationHandler.class)
@Provides
@HandlerPriority(-1025) //HandleBuilder's level, minus one.
public class HandleBuilderDefault extends JavacAnnotationHandler<Builder.Default> {
@Override public void handle(AnnotationValues<Builder.Default> annotation, JCAnnotation ast, JavacNode annotationNode) {
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 The Project Lombok Authors.
* Copyright (C) 2018-2021 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
@@ -23,8 +23,6 @@ package lombok.javac.handlers;
import static lombok.javac.handlers.JavacHandlerUtil.*;
import org.mangosdk.spi.ProviderFor;
import com.sun.tools.javac.tree.JCTree.JCAnnotation;
import lombok.Builder;
@@ -34,8 +32,9 @@ import lombok.core.AnnotationValues;
import lombok.core.HandlerPriority;
import lombok.javac.JavacAnnotationHandler;
import lombok.javac.JavacNode;
import lombok.spi.Provides;
@ProviderFor(JavacAnnotationHandler.class)
@Provides
@HandlerPriority(65536)
@AlreadyHandledAnnotations
public class HandleBuilderDefaultRemove extends JavacAnnotationHandler<Builder.Default> {
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020 The Project Lombok Authors.
* Copyright (C) 2020-2021 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
@@ -23,8 +23,6 @@ package lombok.javac.handlers;
import static lombok.javac.handlers.JavacHandlerUtil.*;
import org.mangosdk.spi.ProviderFor;
import com.sun.tools.javac.tree.JCTree.JCAnnotation;
import lombok.Builder;
@@ -33,8 +31,9 @@ import lombok.core.AnnotationValues;
import lombok.core.HandlerPriority;
import lombok.javac.JavacAnnotationHandler;
import lombok.javac.JavacNode;
import lombok.spi.Provides;
@ProviderFor(JavacAnnotationHandler.class)
@Provides
@HandlerPriority(65536)
@AlreadyHandledAnnotations
public class HandleBuilderRemove extends JavacAnnotationHandler<Builder> {
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2009-2014 The Project Lombok Authors.
* Copyright (C) 2009-2021 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
@@ -32,8 +32,7 @@ import lombok.delombok.LombokOptionsFactory;
import lombok.javac.JavacAnnotationHandler;
import lombok.javac.JavacNode;
import lombok.javac.JavacTreeMaker;
import org.mangosdk.spi.ProviderFor;
import lombok.spi.Provides;
import com.sun.tools.javac.tree.JCTree;
import com.sun.tools.javac.tree.JCTree.JCAnnotation;
@@ -59,7 +58,7 @@ import com.sun.tools.javac.util.Name;
/**
* Handles the {@code lombok.Cleanup} annotation for javac.
*/
@ProviderFor(JavacAnnotationHandler.class)
@Provides
public class HandleCleanup extends JavacAnnotationHandler<Cleanup> {
@Override public void handle(AnnotationValues<Cleanup> annotation, JCAnnotation ast, JavacNode annotationNode) {
handleFlagUsage(annotationNode, ConfigurationKeys.CLEANUP_FLAG_USAGE, "@Cleanup");
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2010-2019 The Project Lombok Authors.
* Copyright (C) 2010-2021 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
@@ -25,8 +25,6 @@ import static lombok.core.handlers.HandlerUtil.*;
import static lombok.javac.Javac.*;
import static lombok.javac.handlers.JavacHandlerUtil.*;
import org.mangosdk.spi.ProviderFor;
import com.sun.tools.javac.code.Flags;
import com.sun.tools.javac.code.Symbol.ClassSymbol;
import com.sun.tools.javac.code.Type;
@@ -62,9 +60,10 @@ import lombok.javac.JavacAnnotationHandler;
import lombok.javac.JavacNode;
import lombok.javac.JavacTreeMaker;
import lombok.javac.handlers.JavacHandlerUtil.MemberExistsResult;
import lombok.spi.Provides;
public class HandleConstructor {
@ProviderFor(JavacAnnotationHandler.class)
@Provides
public static class HandleNoArgsConstructor extends JavacAnnotationHandler<NoArgsConstructor> {
private static final String NAME = NoArgsConstructor.class.getSimpleName();
private HandleConstructor handleConstructor = new HandleConstructor();
@@ -86,7 +85,7 @@ public class HandleConstructor {
}
}
@ProviderFor(JavacAnnotationHandler.class)
@Provides
public static class HandleRequiredArgsConstructor extends JavacAnnotationHandler<RequiredArgsConstructor> {
private static final String NAME = RequiredArgsConstructor.class.getSimpleName();
private HandleConstructor handleConstructor = new HandleConstructor();
@@ -136,7 +135,7 @@ public class HandleConstructor {
return fields.toList();
}
@ProviderFor(JavacAnnotationHandler.class)
@Provides
public static class HandleAllArgsConstructor extends JavacAnnotationHandler<AllArgsConstructor> {
private static final String NAME = AllArgsConstructor.class.getSimpleName();
private HandleConstructor handleConstructor = new HandleConstructor();
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2009-2018 The Project Lombok Authors.
* Copyright (C) 2009-2021 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
@@ -30,8 +30,7 @@ import lombok.core.AnnotationValues;
import lombok.javac.JavacAnnotationHandler;
import lombok.javac.JavacNode;
import lombok.javac.handlers.HandleConstructor.SkipIfConstructorExists;
import org.mangosdk.spi.ProviderFor;
import lombok.spi.Provides;
import com.sun.tools.javac.tree.JCTree.JCAnnotation;
import com.sun.tools.javac.util.List;
@@ -39,7 +38,7 @@ import com.sun.tools.javac.util.List;
/**
* Handles the {@code lombok.Data} annotation for javac.
*/
@ProviderFor(JavacAnnotationHandler.class)
@Provides
public class HandleData extends JavacAnnotationHandler<Data> {
private HandleConstructor handleConstructor = new HandleConstructor();
private HandleGetter handleGetter = new HandleGetter();
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2010-2014 The Project Lombok Authors.
* Copyright (C) 2010-2021 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
@@ -43,8 +43,6 @@ import javax.lang.model.type.ExecutableType;
import javax.lang.model.type.TypeKind;
import javax.lang.model.type.TypeMirror;
import org.mangosdk.spi.ProviderFor;
import com.sun.tools.javac.code.Attribute.Compound;
import com.sun.tools.javac.code.Flags;
import com.sun.tools.javac.code.Symbol;
@@ -82,8 +80,9 @@ import lombok.javac.JavacResolution.TypeNotConvertibleException;
import lombok.javac.JavacTreeMaker;
import lombok.javac.ResolutionResetNeeded;
import lombok.permit.Permit;
import lombok.spi.Provides;
@ProviderFor(JavacAnnotationHandler.class)
@Provides
@HandlerPriority(HandleDelegate.HANDLE_DELEGATE_PRIORITY) //2^16; to make sure that we also delegate generated methods.
@ResolutionResetNeeded
public class HandleDelegate extends JavacAnnotationHandler<Delegate> {
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2009-2020 The Project Lombok Authors.
* Copyright (C) 2009-2021 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
@@ -30,8 +30,6 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import org.mangosdk.spi.ProviderFor;
import com.sun.tools.javac.code.BoundKind;
import com.sun.tools.javac.code.Flags;
import com.sun.tools.javac.tree.JCTree.JCAnnotation;
@@ -70,11 +68,12 @@ import lombok.javac.JavacAnnotationHandler;
import lombok.javac.JavacNode;
import lombok.javac.JavacTreeMaker;
import lombok.javac.handlers.JavacHandlerUtil.MemberExistsResult;
import lombok.spi.Provides;
/**
* Handles the {@code lombok.EqualsAndHashCode} annotation for javac.
*/
@ProviderFor(JavacAnnotationHandler.class)
@Provides
public class HandleEqualsAndHashCode extends JavacAnnotationHandler<EqualsAndHashCode> {
private static final String RESULT_NAME = "result";
private static final String PRIME_NAME = "PRIME";
@@ -39,8 +39,7 @@ import lombok.experimental.ExtensionMethod;
import lombok.javac.JavacAnnotationHandler;
import lombok.javac.JavacNode;
import lombok.javac.JavacResolution;
import org.mangosdk.spi.ProviderFor;
import lombok.spi.Provides;
import com.sun.source.tree.MethodInvocationTree;
import com.sun.source.util.TreeScanner;
@@ -65,7 +64,7 @@ import com.sun.tools.javac.tree.JCTree.JCMethodInvocation;
/**
* Handles the {@link ExtensionMethod} annotation for javac.
*/
@ProviderFor(JavacAnnotationHandler.class)
@Provides
@HandlerPriority(66560) // 2^16 + 2^10; we must run AFTER HandleVal which is at 2^16
public class HandleExtensionMethod extends JavacAnnotationHandler<ExtensionMethod> {
@Override
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2012-2016 The Project Lombok Authors.
* Copyright (C) 2012-2021 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
@@ -34,8 +34,7 @@ import lombok.experimental.PackagePrivate;
import lombok.javac.JavacASTAdapter;
import lombok.javac.JavacASTVisitor;
import lombok.javac.JavacNode;
import org.mangosdk.spi.ProviderFor;
import lombok.spi.Provides;
import com.sun.tools.javac.code.Flags;
import com.sun.tools.javac.tree.JCTree;
@@ -46,7 +45,7 @@ import com.sun.tools.javac.tree.JCTree.JCVariableDecl;
/**
* Handles the {@code lombok.FieldDefaults} annotation for javac.
*/
@ProviderFor(JavacASTVisitor.class)
@Provides(JavacASTVisitor.class)
@HandlerPriority(-2048) //-2^11; to ensure @Value picks up on messing with the fields' 'final' state, run earlier.
public class HandleFieldDefaults extends JavacASTAdapter {
public boolean generateFieldDefaultsForType(JavacNode typeNode, JavacNode errorNode, AccessLevel level, boolean makeFinal, boolean checkForTypeLevelFieldDefaults) {
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2014-2019 The Project Lombok Authors.
* Copyright (C) 2014-2021 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
@@ -36,8 +36,7 @@ import lombok.experimental.FieldNameConstants;
import lombok.javac.JavacAnnotationHandler;
import lombok.javac.JavacNode;
import lombok.javac.JavacTreeMaker;
import org.mangosdk.spi.ProviderFor;
import lombok.spi.Provides;
import com.sun.tools.javac.code.Flags;
import com.sun.tools.javac.tree.JCTree;
@@ -53,7 +52,7 @@ import com.sun.tools.javac.tree.JCTree.JCVariableDecl;
import com.sun.tools.javac.util.List;
import com.sun.tools.javac.util.Name;
@ProviderFor(JavacAnnotationHandler.class)
@Provides
public class HandleFieldNameConstants extends JavacAnnotationHandler<FieldNameConstants> {
private static final IdentifierName FIELDS = IdentifierName.valueOf("Fields");
@@ -43,8 +43,7 @@ import lombok.javac.JavacAnnotationHandler;
import lombok.javac.JavacNode;
import lombok.javac.JavacTreeMaker;
import lombok.javac.JavacTreeMaker.TypeTag;
import org.mangosdk.spi.ProviderFor;
import lombok.spi.Provides;
import com.sun.tools.javac.code.Flags;
import com.sun.tools.javac.code.Type;
@@ -71,7 +70,7 @@ import com.sun.tools.javac.util.Name;
/**
* Handles the {@code lombok.Getter} annotation for javac.
*/
@ProviderFor(JavacAnnotationHandler.class)
@Provides
public class HandleGetter extends JavacAnnotationHandler<Getter> {
public void generateGetterForType(JavacNode typeNode, JavacNode errorNode, AccessLevel level, boolean checkForTypeLevelGetter, List<JCAnnotation> onMethod) {
if (checkForTypeLevelGetter) {
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2015-2016 The Project Lombok Authors.
* Copyright (C) 2015-2021 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
@@ -29,8 +29,6 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import org.mangosdk.spi.ProviderFor;
import com.sun.source.tree.MethodInvocationTree;
import com.sun.source.tree.TreeVisitor;
import com.sun.source.util.TreeScanner;
@@ -56,8 +54,9 @@ import lombok.experimental.Helper;
import lombok.javac.JavacAnnotationHandler;
import lombok.javac.JavacNode;
import lombok.javac.JavacTreeMaker;
import lombok.spi.Provides;
@ProviderFor(JavacAnnotationHandler.class)
@Provides
public class HandleHelper extends JavacAnnotationHandler<Helper> {
private List<JCStatement> getStatementsFromJcNode(JCTree tree) {
if (tree instanceof JCBlock) return ((JCBlock) tree).stats;
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020 The Project Lombok Authors.
* Copyright (C) 2020-2021 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
@@ -24,8 +24,6 @@ package lombok.javac.handlers;
import static lombok.core.handlers.HandlerUtil.handleExperimentalFlagUsage;
import static lombok.javac.handlers.JavacHandlerUtil.*;
import org.mangosdk.spi.ProviderFor;
import com.sun.tools.javac.code.Flags;
import com.sun.tools.javac.tree.JCTree;
import com.sun.tools.javac.tree.JCTree.JCAnnotation;
@@ -49,13 +47,14 @@ import lombok.extern.jackson.Jacksonized;
import lombok.javac.JavacAnnotationHandler;
import lombok.javac.JavacNode;
import lombok.javac.JavacTreeMaker;
import lombok.spi.Provides;
/**
* This (javac) handler deals with {@code @Jacksonized} modifying the (already
* generated) {@code @Builder} or {@code @SuperBuilder} to conform to Jackson's
* needs for builders.
*/
@ProviderFor(JavacAnnotationHandler.class)
@Provides
@HandlerPriority(-512) // Above Handle(Super)Builder's level (builders must be already generated).
public class HandleJacksonized extends JavacAnnotationHandler<Jacksonized> {
+11 -12
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2010-2019 The Project Lombok Authors.
* Copyright (C) 2010-2021 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
@@ -35,8 +35,7 @@ import lombok.javac.JavacAnnotationHandler;
import lombok.javac.JavacNode;
import lombok.javac.JavacTreeMaker;
import lombok.javac.handlers.JavacHandlerUtil.MemberExistsResult;
import org.mangosdk.spi.ProviderFor;
import lombok.spi.Provides;
import com.sun.tools.javac.code.Flags;
import com.sun.tools.javac.tree.JCTree.JCAnnotation;
@@ -154,7 +153,7 @@ public class HandleLog {
/**
* Handles the {@link lombok.extern.apachecommons.CommonsLog} annotation for javac.
*/
@ProviderFor(JavacAnnotationHandler.class)
@Provides
public static class HandleCommonsLog extends JavacAnnotationHandler<lombok.extern.apachecommons.CommonsLog> {
@Override public void handle(AnnotationValues<lombok.extern.apachecommons.CommonsLog> annotation, JCAnnotation ast, JavacNode annotationNode) {
handleFlagUsage(annotationNode, ConfigurationKeys.LOG_COMMONS_FLAG_USAGE, "@apachecommons.CommonsLog", ConfigurationKeys.LOG_ANY_FLAG_USAGE, "any @Log");
@@ -165,7 +164,7 @@ public class HandleLog {
/**
* Handles the {@link lombok.extern.java.Log} annotation for javac.
*/
@ProviderFor(JavacAnnotationHandler.class)
@Provides
public static class HandleJulLog extends JavacAnnotationHandler<lombok.extern.java.Log> {
@Override public void handle(AnnotationValues<lombok.extern.java.Log> annotation, JCAnnotation ast, JavacNode annotationNode) {
handleFlagUsage(annotationNode, ConfigurationKeys.LOG_JUL_FLAG_USAGE, "@java.Log", ConfigurationKeys.LOG_ANY_FLAG_USAGE, "any @Log");
@@ -176,7 +175,7 @@ public class HandleLog {
/**
* Handles the {@link lombok.extern.log4j.Log4j} annotation for javac.
*/
@ProviderFor(JavacAnnotationHandler.class)
@Provides
public static class HandleLog4jLog extends JavacAnnotationHandler<lombok.extern.log4j.Log4j> {
@Override public void handle(AnnotationValues<lombok.extern.log4j.Log4j> annotation, JCAnnotation ast, JavacNode annotationNode) {
handleFlagUsage(annotationNode, ConfigurationKeys.LOG_LOG4J_FLAG_USAGE, "@Log4j", ConfigurationKeys.LOG_ANY_FLAG_USAGE, "any @Log");
@@ -187,7 +186,7 @@ public class HandleLog {
/**
* Handles the {@link lombok.extern.log4j.Log4j2} annotation for javac.
*/
@ProviderFor(JavacAnnotationHandler.class)
@Provides
public static class HandleLog4j2Log extends JavacAnnotationHandler<lombok.extern.log4j.Log4j2> {
@Override public void handle(AnnotationValues<lombok.extern.log4j.Log4j2> annotation, JCAnnotation ast, JavacNode annotationNode) {
handleFlagUsage(annotationNode, ConfigurationKeys.LOG_LOG4J2_FLAG_USAGE, "@Log4j2", ConfigurationKeys.LOG_ANY_FLAG_USAGE, "any @Log");
@@ -198,7 +197,7 @@ public class HandleLog {
/**
* Handles the {@link lombok.extern.slf4j.Slf4j} annotation for javac.
*/
@ProviderFor(JavacAnnotationHandler.class)
@Provides
public static class HandleSlf4jLog extends JavacAnnotationHandler<lombok.extern.slf4j.Slf4j> {
@Override public void handle(AnnotationValues<lombok.extern.slf4j.Slf4j> annotation, JCAnnotation ast, JavacNode annotationNode) {
handleFlagUsage(annotationNode, ConfigurationKeys.LOG_SLF4J_FLAG_USAGE, "@Slf4j", ConfigurationKeys.LOG_ANY_FLAG_USAGE, "any @Log");
@@ -209,7 +208,7 @@ public class HandleLog {
/**
* Handles the {@link lombok.extern.slf4j.XSlf4j} annotation for javac.
*/
@ProviderFor(JavacAnnotationHandler.class)
@Provides
public static class HandleXSlf4jLog extends JavacAnnotationHandler<lombok.extern.slf4j.XSlf4j> {
@Override public void handle(AnnotationValues<lombok.extern.slf4j.XSlf4j> annotation, JCAnnotation ast, JavacNode annotationNode) {
handleFlagUsage(annotationNode, ConfigurationKeys.LOG_XSLF4J_FLAG_USAGE, "@XSlf4j", ConfigurationKeys.LOG_ANY_FLAG_USAGE, "any @Log");
@@ -220,7 +219,7 @@ public class HandleLog {
/**
* Handles the {@link lombok.extern.jbosslog.JBossLog} annotation for javac.
*/
@ProviderFor(JavacAnnotationHandler.class)
@Provides
public static class HandleJBossLog extends JavacAnnotationHandler<lombok.extern.jbosslog.JBossLog> {
@Override public void handle(AnnotationValues<lombok.extern.jbosslog.JBossLog> annotation, JCAnnotation ast, JavacNode annotationNode) {
handleFlagUsage(annotationNode, ConfigurationKeys.LOG_JBOSSLOG_FLAG_USAGE, "@JBossLog", ConfigurationKeys.LOG_ANY_FLAG_USAGE, "any @Log");
@@ -231,7 +230,7 @@ public class HandleLog {
/**
* Handles the {@link lombok.extern.flogger.Flogger} annotation for javac.
*/
@ProviderFor(JavacAnnotationHandler.class)
@Provides
public static class HandleFloggerLog extends JavacAnnotationHandler<lombok.extern.flogger.Flogger> {
@Override public void handle(AnnotationValues<lombok.extern.flogger.Flogger> annotation, JCAnnotation ast, JavacNode annotationNode) {
handleFlagUsage(annotationNode, ConfigurationKeys.LOG_FLOGGER_FLAG_USAGE, "@Flogger", ConfigurationKeys.LOG_ANY_FLAG_USAGE, "any @Log");
@@ -242,7 +241,7 @@ public class HandleLog {
/**
* Handles the {@link lombok.CustomLog} annotation for javac.
*/
@ProviderFor(JavacAnnotationHandler.class)
@Provides
public static class HandleCustomLog extends JavacAnnotationHandler<lombok.CustomLog> {
@Override public void handle(AnnotationValues<lombok.CustomLog> annotation, JCAnnotation ast, JavacNode annotationNode) {
handleFlagUsage(annotationNode, ConfigurationKeys.LOG_CUSTOM_FLAG_USAGE, "@CustomLog", ConfigurationKeys.LOG_ANY_FLAG_USAGE, "any @Log");
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2013-2019 The Project Lombok Authors.
* Copyright (C) 2013-2021 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
@@ -27,8 +27,6 @@ import static lombok.javac.JavacTreeMaker.TreeTag.treeTag;
import static lombok.javac.JavacTreeMaker.TypeTag.typeTag;
import static lombok.javac.handlers.JavacHandlerUtil.*;
import org.mangosdk.spi.ProviderFor;
import com.sun.tools.javac.tree.JCTree.JCAnnotation;
import com.sun.tools.javac.tree.JCTree.JCAssert;
import com.sun.tools.javac.tree.JCTree.JCAssign;
@@ -58,8 +56,9 @@ import lombok.core.AnnotationValues;
import lombok.core.HandlerPriority;
import lombok.javac.JavacAnnotationHandler;
import lombok.javac.JavacNode;
import lombok.spi.Provides;
@ProviderFor(JavacAnnotationHandler.class)
@Provides
@HandlerPriority(value = 512) // 2^9; onParameter=@__(@NonNull) has to run first.
public class HandleNonNull extends JavacAnnotationHandler<NonNull> {
@Override public void handle(AnnotationValues<NonNull> annotation, JCAnnotation ast, JavacNode annotationNode) {
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2009-2014 The Project Lombok Authors.
* Copyright (C) 2009-2021 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
@@ -25,8 +25,6 @@ import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintStream;
import org.mangosdk.spi.ProviderFor;
import com.sun.tools.javac.tree.JCTree.JCAnnotation;
import lombok.Lombok;
@@ -36,11 +34,12 @@ import lombok.core.PrintAST;
import lombok.javac.JavacASTVisitor;
import lombok.javac.JavacAnnotationHandler;
import lombok.javac.JavacNode;
import lombok.spi.Provides;
/**
* Handles the {@code lombok.core.PrintAST} annotation for javac.
*/
@ProviderFor(JavacAnnotationHandler.class)
@Provides
@HandlerPriority(536870912) // 2^29; this handler is customarily run at the very end.
public class HandlePrintAST extends JavacAnnotationHandler<PrintAST> {
@Override public void handle(AnnotationValues<PrintAST> annotation, JCAnnotation ast, JavacNode annotationNode) {
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2009-2020 The Project Lombok Authors.
* Copyright (C) 2009-2021 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
@@ -37,8 +37,7 @@ import lombok.javac.Javac;
import lombok.javac.JavacAnnotationHandler;
import lombok.javac.JavacNode;
import lombok.javac.JavacTreeMaker;
import org.mangosdk.spi.ProviderFor;
import lombok.spi.Provides;
import com.sun.tools.javac.code.Flags;
import com.sun.tools.javac.code.Symbol.ClassSymbol;
@@ -60,7 +59,7 @@ import com.sun.tools.javac.util.Name;
/**
* Handles the {@code lombok.Setter} annotation for javac.
*/
@ProviderFor(JavacAnnotationHandler.class)
@Provides
public class HandleSetter extends JavacAnnotationHandler<Setter> {
public void generateSetterForType(JavacNode typeNode, JavacNode errorNode, AccessLevel level, boolean checkForTypeLevelSetter, List<JCAnnotation> onMethod, List<JCAnnotation> onParam) {
if (checkForTypeLevelSetter) {
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2009-2014 The Project Lombok Authors.
* Copyright (C) 2009-2021 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
@@ -35,8 +35,7 @@ import lombok.core.HandlerPriority;
import lombok.javac.JavacAnnotationHandler;
import lombok.javac.JavacNode;
import lombok.javac.JavacTreeMaker;
import org.mangosdk.spi.ProviderFor;
import lombok.spi.Provides;
import com.sun.tools.javac.code.Flags;
import com.sun.tools.javac.tree.JCTree.JCAnnotation;
@@ -53,7 +52,7 @@ import lombok.javac.Javac;
/**
* Handles the {@code lombok.SneakyThrows} annotation for javac.
*/
@ProviderFor(JavacAnnotationHandler.class)
@Provides
@HandlerPriority(value = 1024) // 2^10; @NonNull must have run first, so that we wrap around the statements generated by it.
public class HandleSneakyThrows extends JavacAnnotationHandler<SneakyThrows> {
@Override public void handle(AnnotationValues<SneakyThrows> annotation, JCAnnotation ast, JavacNode annotationNode) {
@@ -32,8 +32,6 @@ import java.util.HashSet;
import javax.lang.model.element.Modifier;
import org.mangosdk.spi.ProviderFor;
import com.sun.tools.javac.code.BoundKind;
import com.sun.tools.javac.code.Flags;
import com.sun.tools.javac.tree.JCTree;
@@ -84,8 +82,9 @@ import lombok.javac.handlers.JavacSingularsRecipes.ExpressionMaker;
import lombok.javac.handlers.JavacSingularsRecipes.JavacSingularizer;
import lombok.javac.handlers.JavacSingularsRecipes.SingularData;
import lombok.javac.handlers.JavacSingularsRecipes.StatementMaker;
import lombok.spi.Provides;
@ProviderFor(JavacAnnotationHandler.class)
@Provides
@HandlerPriority(-1024) //-2^10; to ensure we've picked up @FieldDefault's changes (-2048) but @Value hasn't removed itself yet (-512), so that we can error on presence of it on the builder classes.
public class HandleSuperBuilder extends JavacAnnotationHandler<SuperBuilder> {
private static final String SELF_METHOD = "self";
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020 The Project Lombok Authors.
* Copyright (C) 2020-2021 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
@@ -23,8 +23,6 @@ package lombok.javac.handlers;
import static lombok.javac.handlers.JavacHandlerUtil.*;
import org.mangosdk.spi.ProviderFor;
import com.sun.tools.javac.tree.JCTree.JCAnnotation;
import lombok.core.AlreadyHandledAnnotations;
@@ -33,8 +31,9 @@ import lombok.core.HandlerPriority;
import lombok.experimental.SuperBuilder;
import lombok.javac.JavacAnnotationHandler;
import lombok.javac.JavacNode;
import lombok.spi.Provides;
@ProviderFor(JavacAnnotationHandler.class)
@Provides
@HandlerPriority(65536)
@AlreadyHandledAnnotations
public class HandleSuperBuilderRemove extends JavacAnnotationHandler<SuperBuilder> {
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2009-2020 The Project Lombok Authors.
* Copyright (C) 2009-2021 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
@@ -33,8 +33,7 @@ import lombok.javac.JavacAnnotationHandler;
import lombok.javac.JavacNode;
import lombok.javac.JavacTreeMaker;
import lombok.javac.handlers.JavacHandlerUtil.MemberExistsResult;
import org.mangosdk.spi.ProviderFor;
import lombok.spi.Provides;
import com.sun.tools.javac.code.Flags;
import com.sun.tools.javac.tree.JCTree;
@@ -51,7 +50,7 @@ import com.sun.tools.javac.util.List;
/**
* Handles the {@code lombok.Synchronized} annotation for javac.
*/
@ProviderFor(JavacAnnotationHandler.class)
@Provides
@HandlerPriority(value = 1024) // 2^10; @NonNull must have run first, so that we wrap around the statements generated by it.
public class HandleSynchronized extends JavacAnnotationHandler<Synchronized> {
private static final String INSTANCE_LOCK_NAME = "$lock";
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2009-2020 The Project Lombok Authors.
* Copyright (C) 2009-2021 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
@@ -38,8 +38,7 @@ import lombok.core.handlers.InclusionExclusionUtils.Included;
import lombok.javac.JavacAnnotationHandler;
import lombok.javac.JavacNode;
import lombok.javac.JavacTreeMaker;
import org.mangosdk.spi.ProviderFor;
import lombok.spi.Provides;
import com.sun.tools.javac.code.Flags;
import com.sun.tools.javac.tree.JCTree.JCAnnotation;
@@ -59,7 +58,7 @@ import com.sun.tools.javac.util.List;
/**
* Handles the {@code ToString} annotation for javac.
*/
@ProviderFor(JavacAnnotationHandler.class)
@Provides
public class HandleToString extends JavacAnnotationHandler<ToString> {
@Override public void handle(AnnotationValues<ToString> annotation, JCAnnotation ast, JavacNode annotationNode) {
handleFlagUsage(annotationNode, ConfigurationKeys.TO_STRING_FLAG_USAGE, "@ToString");
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2015-2020 The Project Lombok Authors.
* Copyright (C) 2015-2021 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
@@ -25,8 +25,6 @@ import static lombok.core.handlers.HandlerUtil.handleExperimentalFlagUsage;
import static lombok.javac.Javac.CTC_VOID;
import static lombok.javac.handlers.JavacHandlerUtil.*;
import org.mangosdk.spi.ProviderFor;
import com.sun.tools.javac.code.Flags;
import com.sun.tools.javac.code.Type;
import com.sun.tools.javac.tree.JCTree.JCAnnotation;
@@ -50,12 +48,13 @@ import lombok.javac.Javac;
import lombok.javac.JavacAnnotationHandler;
import lombok.javac.JavacNode;
import lombok.javac.JavacTreeMaker;
import lombok.spi.Provides;
/**
* Handles the {@code @UtilityClass} annotation for javac.
*/
@HandlerPriority(-4096) //-2^12; to ensure @FieldDefaults picks up on the 'static' we set here.
@ProviderFor(JavacAnnotationHandler.class)
@Provides
public class HandleUtilityClass extends JavacAnnotationHandler<UtilityClass> {
@Override public void handle(AnnotationValues<UtilityClass> annotation, JCAnnotation ast, JavacNode annotationNode) {
handleExperimentalFlagUsage(annotationNode, ConfigurationKeys.UTILITY_CLASS_FLAG_USAGE, "@UtilityClass");
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2010-2018 The Project Lombok Authors.
* Copyright (C) 2010-2021 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
@@ -33,8 +33,7 @@ import lombok.javac.JavacASTVisitor;
import lombok.javac.JavacNode;
import lombok.javac.JavacResolution;
import lombok.javac.ResolutionResetNeeded;
import org.mangosdk.spi.ProviderFor;
import lombok.spi.Provides;
import com.sun.tools.javac.code.Flags;
import com.sun.tools.javac.code.Symtab;
@@ -49,7 +48,7 @@ import com.sun.tools.javac.tree.JCTree.JCNewArray;
import com.sun.tools.javac.tree.JCTree.JCVariableDecl;
import com.sun.tools.javac.util.List;
@ProviderFor(JavacASTVisitor.class)
@Provides(JavacASTVisitor.class)
@HandlerPriority(HANDLE_DELEGATE_PRIORITY + 100) // run slightly after HandleDelegate; resolution needs to work, so if the RHS expression is i.e. a call to a generated getter, we have to run after that getter has been generated.
@ResolutionResetNeeded
public class HandleVal extends JavacASTAdapter {
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2012-2018 The Project Lombok Authors.
* Copyright (C) 2012-2021 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
@@ -33,8 +33,7 @@ import lombok.Value;
import lombok.javac.JavacAnnotationHandler;
import lombok.javac.JavacNode;
import lombok.javac.handlers.HandleConstructor.SkipIfConstructorExists;
import org.mangosdk.spi.ProviderFor;
import lombok.spi.Provides;
import com.sun.tools.javac.code.Flags;
import com.sun.tools.javac.tree.JCTree.JCAnnotation;
@@ -45,7 +44,7 @@ import com.sun.tools.javac.util.List;
/**
* Handles the {@code lombok.Value} annotation for javac.
*/
@ProviderFor(JavacAnnotationHandler.class)
@Provides
@HandlerPriority(-512) //-2^9; to ensure @EqualsAndHashCode and such pick up on this handler making the class final and messing with the fields' access levels, run earlier.
public class HandleValue extends JavacAnnotationHandler<Value> {
private HandleFieldDefaults handleFieldDefaults = new HandleFieldDefaults();
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2012-2020 The Project Lombok Authors.
* Copyright (C) 2012-2021 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
@@ -37,8 +37,7 @@ import lombok.javac.JavacAnnotationHandler;
import lombok.javac.JavacNode;
import lombok.javac.JavacTreeMaker;
import lombok.javac.handlers.JavacHandlerUtil.CopyJavadoc;
import org.mangosdk.spi.ProviderFor;
import lombok.spi.Provides;
import com.sun.tools.javac.code.Flags;
import com.sun.tools.javac.code.Type;
@@ -62,7 +61,7 @@ import com.sun.tools.javac.util.Name;
/**
* Handles the {@code lombok.With} annotation for javac.
*/
@ProviderFor(JavacAnnotationHandler.class)
@Provides
public class HandleWith extends JavacAnnotationHandler<With> {
public void generateWithForType(JavacNode typeNode, JavacNode errorNode, AccessLevel level, boolean checkForTypeLevelWith) {
if (checkForTypeLevelWith) {
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020 The Project Lombok Authors.
* Copyright (C) 2020-2021 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
@@ -41,8 +41,7 @@ import lombok.javac.JavacNode;
import lombok.javac.JavacTreeMaker;
import lombok.javac.JavacTreeMaker.TypeTag;
import lombok.javac.handlers.JavacHandlerUtil.CopyJavadoc;
import org.mangosdk.spi.ProviderFor;
import lombok.spi.Provides;
import com.sun.tools.javac.code.BoundKind;
import com.sun.tools.javac.code.Flags;
@@ -67,7 +66,7 @@ import com.sun.tools.javac.util.Name;
/**
* Handles the {@code lombok.With} annotation for javac.
*/
@ProviderFor(JavacAnnotationHandler.class)
@Provides
public class HandleWithBy extends JavacAnnotationHandler<WithBy> {
public void generateWithByForType(JavacNode typeNode, JavacNode errorNode, AccessLevel level, boolean checkForTypeLevelWithBy) {
if (checkForTypeLevelWithBy) {
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2015 The Project Lombok Authors.
* Copyright (C) 2015-2021 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
@@ -23,10 +23,9 @@ package lombok.javac.handlers.singulars;
import lombok.core.LombokImmutableList;
import lombok.javac.handlers.JavacSingularsRecipes.JavacSingularizer;
import lombok.spi.Provides;
import org.mangosdk.spi.ProviderFor;
@ProviderFor(JavacSingularizer.class)
@Provides(JavacSingularizer.class)
public class JavacGuavaMapSingularizer extends JavacGuavaSingularizer {
// TODO cgcc.ImmutableMultimap, cgcc.ImmutableListMultimap, cgcc.ImmutableSetMultimap
// TODO cgcc.ImmutableClassToInstanceMap
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2015 The Project Lombok Authors.
* Copyright (C) 2015-2021 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
@@ -21,12 +21,11 @@
*/
package lombok.javac.handlers.singulars;
import org.mangosdk.spi.ProviderFor;
import lombok.core.LombokImmutableList;
import lombok.javac.handlers.JavacSingularsRecipes.JavacSingularizer;
import lombok.spi.Provides;
@ProviderFor(JavacSingularizer.class)
@Provides(JavacSingularizer.class)
public class JavacGuavaSetListSingularizer extends JavacGuavaSingularizer {
// TODO com.google.common.collect.ImmutableRangeSet
// TODO com.google.common.collect.ImmutableMultiset and com.google.common.collect.ImmutableSortedMultiset
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2015 The Project Lombok Authors.
* Copyright (C) 2015-2021 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
@@ -21,12 +21,11 @@
*/
package lombok.javac.handlers.singulars;
import org.mangosdk.spi.ProviderFor;
import lombok.core.LombokImmutableList;
import lombok.javac.handlers.JavacSingularsRecipes.JavacSingularizer;
import lombok.spi.Provides;
@ProviderFor(JavacSingularizer.class)
@Provides(JavacSingularizer.class)
public class JavacGuavaTableSingularizer extends JavacGuavaSingularizer {
private static final LombokImmutableList<String> SUFFIXES =
LombokImmutableList.of("rowKey", "columnKey", "value");
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2015 The Project Lombok Authors.
* Copyright (C) 2015-2021 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
@@ -24,13 +24,12 @@ package lombok.javac.handlers.singulars;
import static lombok.javac.Javac.*;
import static lombok.javac.handlers.JavacHandlerUtil.*;
import org.mangosdk.spi.ProviderFor;
import lombok.core.LombokImmutableList;
import lombok.javac.JavacNode;
import lombok.javac.JavacTreeMaker;
import lombok.javac.handlers.JavacSingularsRecipes.JavacSingularizer;
import lombok.javac.handlers.JavacSingularsRecipes.SingularData;
import lombok.spi.Provides;
import com.sun.tools.javac.tree.JCTree.JCCase;
import com.sun.tools.javac.tree.JCTree.JCExpression;
@@ -39,7 +38,7 @@ import com.sun.tools.javac.util.List;
import com.sun.tools.javac.util.ListBuffer;
import com.sun.tools.javac.util.Name;
@ProviderFor(JavacSingularizer.class)
@Provides(JavacSingularizer.class)
public class JavacJavaUtilListSingularizer extends JavacJavaUtilListSetSingularizer {
@Override public LombokImmutableList<String> getSupportedTypes() {
return LombokImmutableList.of("java.util.List", "java.util.Collection", "java.lang.Iterable");
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2015-2019 The Project Lombok Authors.
* Copyright (C) 2015-2021 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
@@ -36,8 +36,7 @@ import lombok.javac.handlers.JavacSingularsRecipes.ExpressionMaker;
import lombok.javac.handlers.JavacSingularsRecipes.JavacSingularizer;
import lombok.javac.handlers.JavacSingularsRecipes.SingularData;
import lombok.javac.handlers.JavacSingularsRecipes.StatementMaker;
import org.mangosdk.spi.ProviderFor;
import lombok.spi.Provides;
import com.sun.tools.javac.code.Flags;
import com.sun.tools.javac.tree.JCTree.JCBlock;
@@ -48,7 +47,7 @@ import com.sun.tools.javac.util.List;
import com.sun.tools.javac.util.ListBuffer;
import com.sun.tools.javac.util.Name;
@ProviderFor(JavacSingularizer.class)
@Provides(JavacSingularizer.class)
public class JavacJavaUtilMapSingularizer extends JavacJavaUtilSingularizer {
@Override public LombokImmutableList<String> getSupportedTypes() {
return LombokImmutableList.of("java.util.Map", "java.util.SortedMap", "java.util.NavigableMap");
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2015 The Project Lombok Authors.
* Copyright (C) 2015-2021 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
@@ -21,19 +21,18 @@
*/
package lombok.javac.handlers.singulars;
import org.mangosdk.spi.ProviderFor;
import lombok.core.LombokImmutableList;
import lombok.javac.JavacNode;
import lombok.javac.JavacTreeMaker;
import lombok.javac.handlers.JavacSingularsRecipes.JavacSingularizer;
import lombok.javac.handlers.JavacSingularsRecipes.SingularData;
import lombok.spi.Provides;
import com.sun.tools.javac.tree.JCTree.JCStatement;
import com.sun.tools.javac.util.ListBuffer;
import com.sun.tools.javac.util.Name;
@ProviderFor(JavacSingularizer.class)
@Provides(JavacSingularizer.class)
public class JavacJavaUtilSetSingularizer extends JavacJavaUtilListSetSingularizer {
@Override public LombokImmutableList<String> getSupportedTypes() {
return LombokImmutableList.of("java.util.Set", "java.util.SortedSet", "java.util.NavigableSet");
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2009 The Project Lombok Authors.
* Copyright (C) 2009-2021 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
@@ -37,10 +37,9 @@ import java.util.jar.JarFile;
import lombok.core.LombokApp;
import lombok.permit.Permit;
import lombok.spi.Provides;
import org.mangosdk.spi.ProviderFor;
@ProviderFor(LombokApp.class)
@Provides
public class DelombokApp extends LombokApp {
@Override public int runApp(List<String> args) throws Exception {
try {
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2009-2016 The Project Lombok Authors.
* Copyright (C) 2009-2021 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
@@ -40,8 +40,7 @@ import lombok.core.SpiLoadUtil;
import lombok.core.Version;
import lombok.installer.OsUtils.OS;
import lombok.patcher.ClassRootFinder;
import org.mangosdk.spi.ProviderFor;
import lombok.spi.Provides;
import com.zwitserloot.cmdreader.CmdReader;
import com.zwitserloot.cmdreader.Description;
@@ -105,7 +104,7 @@ public class Installer {
return a.equals(b);
}
@ProviderFor(LombokApp.class)
@Provides
public static class GraphicalInstallerApp extends LombokApp {
@Override public String getAppName() {
return "installer";
@@ -124,7 +123,7 @@ public class Installer {
}
}
@ProviderFor(LombokApp.class)
@Provides
public static class CommandLineInstallerApp extends LombokApp {
@Override public String getAppName() {
return "install";
@@ -139,7 +138,7 @@ public class Installer {
}
}
@ProviderFor(LombokApp.class)
@Provides
public static class CommandLineUninstallerApp extends LombokApp {
@Override public String getAppName() {
return "uninstall";
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 The Project Lombok Authors.
* Copyright (C) 2018-2021 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
@@ -23,11 +23,10 @@ package lombok.installer.eclipse;
import java.util.Collections;
import org.mangosdk.spi.ProviderFor;
import lombok.installer.IdeLocationProvider;
import lombok.spi.Provides;
@ProviderFor(IdeLocationProvider.class)
@Provides(IdeLocationProvider.class)
public class AngularIDELocationProvider extends EclipseProductLocationProvider {
private static final EclipseProductDescriptor ANGULAR = new StandardProductDescriptor(
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2009-2016 The Project Lombok Authors.
* Copyright (C) 2009-2021 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
@@ -24,10 +24,9 @@ package lombok.installer.eclipse;
import java.util.Collections;
import lombok.installer.IdeLocationProvider;
import lombok.spi.Provides;
import org.mangosdk.spi.ProviderFor;
@ProviderFor(IdeLocationProvider.class)
@Provides(IdeLocationProvider.class)
public class EclipseLocationProvider extends EclipseProductLocationProvider {
private static final EclipseProductDescriptor ECLIPSE = new StandardProductDescriptor(
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2013-2016 The Project Lombok Authors.
* Copyright (C) 2013-2021 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
@@ -24,10 +24,9 @@ package lombok.installer.eclipse;
import java.util.Collections;
import lombok.installer.IdeLocationProvider;
import lombok.spi.Provides;
import org.mangosdk.spi.ProviderFor;
@ProviderFor(IdeLocationProvider.class)
@Provides(IdeLocationProvider.class)
public class JbdsLocationProvider extends EclipseProductLocationProvider {
private static final EclipseProductDescriptor JBDS = new StandardProductDescriptor(
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2016 The Project Lombok Authors.
* Copyright (C) 2016-2021 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
@@ -24,10 +24,9 @@ package lombok.installer.eclipse;
import java.util.Collections;
import lombok.installer.IdeLocationProvider;
import lombok.spi.Provides;
import org.mangosdk.spi.ProviderFor;
@ProviderFor(IdeLocationProvider.class)
@Provides(IdeLocationProvider.class)
public class MyEclipseLocationProvider extends EclipseProductLocationProvider {
private static final EclipseProductDescriptor MY_ECLIPSE = new StandardProductDescriptor(
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020 The Project Lombok Authors.
* Copyright (C) 2020-2021 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
@@ -24,10 +24,9 @@ package lombok.installer.eclipse;
import java.util.Collections;
import lombok.installer.IdeLocationProvider;
import lombok.spi.Provides;
import org.mangosdk.spi.ProviderFor;
@ProviderFor(IdeLocationProvider.class)
@Provides(IdeLocationProvider.class)
public class RhcrLocationProvider extends EclipseProductLocationProvider {
private static final EclipseProductDescriptor RHCR = new StandardProductDescriptor(
"Red Hat CodeReady Studio",
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2013-2016 The Project Lombok Authors.
* Copyright (C) 2013-2021 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
@@ -24,10 +24,9 @@ package lombok.installer.eclipse;
import java.util.Collections;
import lombok.installer.IdeLocationProvider;
import lombok.spi.Provides;
import org.mangosdk.spi.ProviderFor;
@ProviderFor(IdeLocationProvider.class)
@Provides(IdeLocationProvider.class)
public class RhdsLocationProvider extends EclipseProductLocationProvider {
private static final EclipseProductDescriptor RHDS = new StandardProductDescriptor(
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 The Project Lombok Authors.
* Copyright (C) 2018-2021 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
@@ -25,10 +25,9 @@ import java.util.Arrays;
import java.util.Collections;
import lombok.installer.IdeLocationProvider;
import lombok.spi.Provides;
import org.mangosdk.spi.ProviderFor;
@ProviderFor(IdeLocationProvider.class)
@Provides(IdeLocationProvider.class)
public class STS4LocationProvider extends EclipseProductLocationProvider {
private static final EclipseProductDescriptor STS4 = new StandardProductDescriptor("Spring Tools Suite 4",
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2009-2016 The Project Lombok Authors.
* Copyright (C) 2009-2021 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
@@ -24,10 +24,9 @@ package lombok.installer.eclipse;
import java.util.Collections;
import lombok.installer.IdeLocationProvider;
import lombok.spi.Provides;
import org.mangosdk.spi.ProviderFor;
@ProviderFor(IdeLocationProvider.class)
@Provides(IdeLocationProvider.class)
public class STSLocationProvider extends EclipseProductLocationProvider {
private static final EclipseProductDescriptor STS = new StandardProductDescriptor("STS",
+33
View File
@@ -0,0 +1,33 @@
/*
* Copyright (C) 2021 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package lombok.spi;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.SOURCE)
public @interface Provides {
Class<?>[] value() default {};
}
@@ -0,0 +1,254 @@
/*
* Copyright (C) 2021 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package lombok.spi;
import java.io.IOException;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Deque;
import java.util.List;
import java.util.Map.Entry;
import java.util.Set;
import javax.annotation.processing.AbstractProcessor;
import javax.annotation.processing.ProcessingEnvironment;
import javax.annotation.processing.RoundEnvironment;
import javax.annotation.processing.SupportedAnnotationTypes;
import javax.lang.model.SourceVersion;
import javax.lang.model.element.AnnotationMirror;
import javax.lang.model.element.AnnotationValue;
import javax.lang.model.element.Element;
import javax.lang.model.element.ElementKind;
import javax.lang.model.element.ExecutableElement;
import javax.lang.model.element.Modifier;
import javax.lang.model.element.Name;
import javax.lang.model.element.TypeElement;
import javax.lang.model.type.DeclaredType;
import javax.lang.model.type.TypeMirror;
import javax.tools.Diagnostic.Kind;
@SupportedAnnotationTypes("*")
public class SpiProcessor extends AbstractProcessor {
private SpiProcessorCollector data;
private SpiProcessorPersistence persistence;
static String getRootPathOfServiceFiles() {
return "META-INF/services/";
}
@Override public SourceVersion getSupportedSourceVersion() {
return SourceVersion.latest();
}
static String toErrorMsg(Exception e, String pathName) {
StringBuilder sb = new StringBuilder();
sb.append("Exception applying SPI processor on ").append(pathName).append(": ").append(toStringLong(e));
return sb.toString();
}
private static String toStringLong(Throwable t) {
if (t == null) return "NULL";
StringBuilder out = new StringBuilder();
String msg = t.getMessage();
out.append(t.getClass().getName());
if (msg != null) out.append(": ").append(msg);
String indent = " ";
StackTraceElement[] elems = t.getStackTrace();
if (elems != null) for (int i = 0; i < elems.length; i++) {
out.append("\n").append(indent).append(elems[i]);
}
Throwable cause = t.getCause();
while (cause != null) {
indent = indent + " ";
out.append("\n").append(indent).append("Caused by: ").append(cause.getClass().getName());
msg = cause.getMessage();
if (msg != null) out.append(": ").append(msg);
elems = cause.getStackTrace();
indent = indent + " ";
if (elems != null) for (int i = 0; i < elems.length; i++) {
out.append("\n").append(indent).append(elems[i]);
}
cause = cause.getCause();
}
return out.toString();
}
@Override public synchronized void init(ProcessingEnvironment processingEnv) {
super.init(processingEnv);
persistence = new SpiProcessorPersistence("SpiProcessor", processingEnv.getFiler(), processingEnv.getMessager());
data = new SpiProcessorCollector(processingEnv);
for (String serviceName : persistence.tryFind()) data.getService(serviceName);
data.stripProvidersWithoutSourceFile();
}
@Override public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
removeStaleData(roundEnv);
handleAnnotations(roundEnv);
if (roundEnv.processingOver()) writeData();
return false;
}
private void writeData() {
for (SpiProcessorService service : data.services()) {
try {
persistence.write(service.getName(), service.toProvidersListFormat());
}
catch (IOException e) {
processingEnv.getMessager().printMessage(Kind.ERROR, e.getMessage());
}
}
}
private void removeStaleData(RoundEnvironment roundEnv) {
for (Element e : roundEnv.getRootElements()) {
if (e instanceof TypeElement) {
TypeElement currentClass = (TypeElement) e;
data.removeProvider(createProperQualifiedName(currentClass));
}
}
}
private void handleAnnotations(RoundEnvironment roundEnv) {
Set<? extends Element> elements = roundEnv.getElementsAnnotatedWith(Provides.class);
for (Element e : elements) handleProvidingElement(e);
}
private void handleProvidingElement(Element element) {
if (element.getKind() != ElementKind.CLASS) {
report(element, "is not a class definition");
return;
}
TypeElement elem = (TypeElement) element;
Element enclosing = elem.getEnclosingElement();
if (enclosing != null && enclosing.getKind() == ElementKind.CLASS && !elem.getModifiers().contains(Modifier.STATIC)) {
report(elem, "is a non-static inner class");
return;
}
boolean hasConstructors = false;
boolean hasNoArgsConstructor = false;
for (Element child : elem.getEnclosedElements()) {
if (child.getKind() != ElementKind.CONSTRUCTOR) continue;
ExecutableElement ee = (ExecutableElement) child;
hasConstructors = true;
if (ee.getParameters().isEmpty()) {
hasNoArgsConstructor = true;
break;
}
}
if (hasConstructors && !hasNoArgsConstructor) {
report(elem, "has no no-args constructor");
return;
}
List<TypeMirror> spiTypes = new ArrayList<TypeMirror>();
for (AnnotationMirror annMirror : element.getAnnotationMirrors()) {
if (!getQualifiedTypeName(annMirror).contentEquals(Provides.class.getName())) continue;
for (Entry<? extends ExecutableElement, ? extends AnnotationValue> entry : annMirror.getElementValues().entrySet()) {
if (!entry.getKey().getSimpleName().contentEquals("value")) continue;
Object list = entry.getValue().getValue();
if (list instanceof TypeMirror) spiTypes.add((TypeMirror) list);
else if (list instanceof List<?>) {
for (Object tm : (List<?>) list) {
if (tm instanceof AnnotationValue) tm = ((AnnotationValue) tm).getValue();
if (tm instanceof TypeMirror) {
TypeMirror mirror = (TypeMirror) tm;
mirror = processingEnv.getTypeUtils().erasure(mirror);
spiTypes.add(mirror);
}
}
}
}
}
TypeMirror superclass = elem.getSuperclass();
if (spiTypes.isEmpty()) {
List<TypeMirror> qualifying = new ArrayList<TypeMirror>();
qualifying.addAll(elem.getInterfaces());
if (superclass != null && !toElement(superclass).getQualifiedName().contentEquals("java.lang.Object")) qualifying.add(superclass);
if (qualifying.isEmpty()) {
report(elem, "is marked @Provides but implements/extends nothing");
return;
}
if (qualifying.size() > 1) {
report(elem, "is marked @Provides but implements/extends multiple types; explicitly specify which interface(s) this provides for");
return;
}
spiTypes.add(qualifying.get(0));
} else {
Deque<TypeMirror> parentage = new ArrayDeque<TypeMirror>();
parentage.addAll(elem.getInterfaces());
parentage.add(superclass);
List<TypeMirror> needed = new ArrayList<TypeMirror>();
needed.addAll(spiTypes);
while (!parentage.isEmpty() && !spiTypes.isEmpty()) {
TypeMirror parent = parentage.pollFirst();
if (parent == null) continue;
needed.remove(parent);
parentage.addAll(processingEnv.getTypeUtils().directSupertypes(parent));
}
if (!needed.isEmpty()) {
report(elem, "is marked as providing " + needed + " but does not implement it");
return;
}
}
for (TypeMirror spiType : spiTypes) {
String spiTypeName = toElement(spiType).getQualifiedName().toString();
String createProperQualifiedName = createProperQualifiedName(elem);
data.getService(spiTypeName).addProvider(createProperQualifiedName);
}
}
private Name getQualifiedTypeName(AnnotationMirror mirror) {
Element elem = mirror.getAnnotationType().asElement();
if (!(elem instanceof TypeElement)) return null;
return ((TypeElement) elem).getQualifiedName();
}
private TypeElement toElement(TypeMirror typeMirror) {
if (typeMirror instanceof DeclaredType) {
Element asElement = ((DeclaredType) typeMirror).asElement();
if (asElement instanceof TypeElement) return (TypeElement) asElement;
}
return null;
}
private void report(Element elem, String message) {
/* In eclipse, messages just seem to get ignored, so we throw instead. */
if (Boolean.TRUE) throw new RuntimeException(elem.getSimpleName() + " " + message);
processingEnv.getMessager().printMessage(Kind.ERROR, elem.getSimpleName() + " " + message, elem);
}
private String createProperQualifiedName(TypeElement provider) {
return processingEnv.getElementUtils().getBinaryName(provider).toString();
}
}
@@ -0,0 +1,107 @@
/*
* Copyright (C) 2021 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package lombok.spi;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.processing.Filer;
import javax.annotation.processing.Messager;
import javax.annotation.processing.ProcessingEnvironment;
import javax.lang.model.util.Elements;
import javax.tools.Diagnostic.Kind;
import javax.tools.FileObject;
import javax.tools.StandardLocation;
class SpiProcessorCollector {
private final Map<String, SpiProcessorService> services = new HashMap<String, SpiProcessorService>();
private final List<String> removed = new ArrayList<String>();
private final Elements elements;
private final Messager logger;
private final Filer filer;
SpiProcessorCollector(ProcessingEnvironment processingEnv) {
this.elements = processingEnv.getElementUtils();
this.logger = processingEnv.getMessager();
this.filer = processingEnv.getFiler();
}
SpiProcessorCollector(Elements elements, Messager logger, Filer filer) {
if (elements == null) throw new NullPointerException("elements");
if (logger == null) throw new NullPointerException("logger");
if (filer == null) throw new NullPointerException("filer");
this.elements = elements;
this.logger = logger;
this.filer = filer;
}
SpiProcessorService getService(String serviceName) {
if (serviceName == null) throw new NullPointerException("serviceName");
if (!services.containsKey(serviceName)) {
SpiProcessorService newService = new SpiProcessorService(serviceName);
CharSequence initialData = readInitialData(serviceName);
if (initialData != null) {
newService.addAllFromProvidersNameList(initialData.toString());
for (String provider : removed) newService.removeProvider(provider);
}
services.put(serviceName, newService);
}
return services.get(serviceName);
}
Collection<SpiProcessorService> services() {
return Collections.unmodifiableMap(services).values();
}
void removeProvider(String provider) {
if (provider == null) throw new NullPointerException("provider");
removed.add(provider);
for (SpiProcessorService service : services.values()) service.removeProvider(provider);
}
@Override public String toString() {
return services.values().toString();
}
private CharSequence readInitialData(String serviceName) {
String pathName = SpiProcessor.getRootPathOfServiceFiles() + serviceName;
FileObject resource;
try {
resource = filer.getResource(StandardLocation.CLASS_OUTPUT, "", pathName);
} catch (Exception e) {
logger.printMessage(Kind.ERROR, SpiProcessor.toErrorMsg(e, pathName));
return null;
}
return SpiProcessorPersistence.readFilerResource(resource, logger, pathName);
}
void stripProvidersWithoutSourceFile() {
for (SpiProcessorService s : services.values()) s.stripProvidersWithoutSourceFile(elements);
}
}
@@ -0,0 +1,148 @@
/*
* Copyright (C) 2021 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package lombok.spi;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.Reader;
import java.io.Writer;
import java.net.URI;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import javax.annotation.processing.Filer;
import javax.annotation.processing.Messager;
import javax.tools.Diagnostic.Kind;
import javax.tools.FileObject;
import javax.tools.StandardLocation;
class SpiProcessorPersistence {
private final String name;
private final String path;
final Filer filer;
private final Messager logger;
SpiProcessorPersistence(String name, Filer filer, Messager logger) {
this.name = name;
this.logger = logger;
this.path = SpiProcessor.getRootPathOfServiceFiles();
this.filer = filer;
}
static CharSequence readFilerResource(FileObject resource, Messager logger, String pathName) {
try {
// Eclipse can't handle getCharContent, so we must use a reader...
return tryWithReader(resource);
} catch (FileNotFoundException e) {
return null;
} catch (IOException e) {
if (
e.getClass().getName().equals("org.eclipse.core.internal.resources.ResourceException") &&
e.getMessage() != null &&
e.getMessage().endsWith("does not exist.")) {
return null;
}
logger.printMessage(Kind.ERROR, SpiProcessor.toErrorMsg(e, pathName));
return null;
} catch (Exception other) {
// otherwise, probably javac: Some versions don't support the `openReader` method.
try {
return resource.getCharContent(true);
} catch (FileNotFoundException e) {
return null;
} catch (IOException e) {
logger.printMessage(Kind.ERROR, SpiProcessor.toErrorMsg(e, pathName));
return null;
}
}
}
private static CharSequence tryWithReader(FileObject resource) throws IOException {
StringBuilder sb = new StringBuilder();
Reader raw = resource.openReader(true);
try {
BufferedReader in = new BufferedReader(raw);
for (String line = in.readLine(); line != null; line = in.readLine()) sb.append(line).append('\n');
return sb;
} finally {
if (raw != null) raw.close();
}
}
Collection<String> tryFind() {
File dir = determineOutputLocation();
if (dir == null || !dir.isDirectory()) return Collections.emptyList();
List<String> out = new ArrayList<String>();
for (File p : dir.listFiles()) {
if (!p.isFile()) continue;
out.add(p.getName());
}
return out;
}
private File determineOutputLocation() {
FileObject resource;
try {
resource = filer.createResource(StandardLocation.CLASS_OUTPUT, "META-INF", "locator.tmp");
} catch (FileNotFoundException e) {
e.printStackTrace();
// Could happen
return null;
} catch (IOException e) {
e.printStackTrace();
logger.printMessage(Kind.NOTE, "IOException while determining output location: " + e.getMessage());
return null;
} catch (IllegalArgumentException e) {
e.printStackTrace();
// Happens when the path is invalid. For instance absolute or relative to a path
// not part of the class output folder.
//
// Due to a bug in javac for Linux, this also occurs when no output path is specified
// for javac using the -d parameter.
// See http://forums.sun.com/thread.jspa?threadID=5240999&tstart=45
// and http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6647996
return null;
}
URI uri = resource.toUri();
return new File(new File(uri).getParentFile(), "services");
}
void write(String serviceName, String value) throws IOException {
FileObject output = filer.createResource(StandardLocation.CLASS_OUTPUT, "", path + serviceName);
Writer writer = output.openWriter();
writer.write("# Generated by " + name + "\n");
writer.write("# " + new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss Z", Locale.US).format(new Date()) + "\n");
writer.write(value);
writer.close();
}
}
@@ -0,0 +1,83 @@
/*
* Copyright (C) 2021 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package lombok.spi;
import java.util.Iterator;
import java.util.Set;
import java.util.TreeSet;
import java.util.stream.Collectors;
import javax.lang.model.util.Elements;
final class SpiProcessorService {
private final String name;
private final Set<String> providers = new TreeSet<String>();
SpiProcessorService(String name) {
if (name == null) throw new NullPointerException("name");
this.name = name;
}
public String getName() {
return name;
}
void addProvider(String className) {
if (className == null) throw new NullPointerException("className");
providers.add(className);
}
boolean removeProvider(String provider) {
return providers.remove(provider);
}
String toProvidersListFormat() {
return providers.stream().collect(Collectors.joining("\n"));
}
void addAllFromProvidersNameList(String in) {
for (String line : in.split("\\n")) {
String[] content = line.split("#", 2);
if (content.length == 0) continue;
String trimmed = content[0].trim();
String[] elems = trimmed.split("\\s+", 2);
if (elems.length == 0 || elems[0].isEmpty()) continue;
String cn = elems[0];
addProvider(cn);
}
}
void stripProvidersWithoutSourceFile(Elements elements) {
Iterator<String> it = providers.iterator();
while (it.hasNext()) {
if (!sourceExists(elements, it.next())) it.remove();
}
}
private boolean sourceExists(Elements elements, String typeName) {
return elements.getTypeElement(typeName) != null;
}
@Override public String toString() {
return name + " = " + providers;
}
}