2022-03-07 09:34:54 +00:00
|
|
|
package lombok.core.configuration;
|
|
|
|
|
|
|
|
import com.adjust.sdk.Constants;
|
|
|
|
import java.io.ByteArrayOutputStream;
|
|
|
|
import java.io.File;
|
|
|
|
import java.io.FileInputStream;
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.io.InputStream;
|
|
|
|
import java.net.URI;
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
|
|
import java.util.concurrent.ConcurrentMap;
|
|
|
|
import java.util.regex.Matcher;
|
|
|
|
import java.util.regex.Pattern;
|
|
|
|
import java.util.zip.ZipEntry;
|
|
|
|
import java.util.zip.ZipInputStream;
|
2022-03-08 19:23:59 +00:00
|
|
|
/* loaded from: com.discord-118106.apk:lombok/core/configuration/ConfigurationFile.SCL.lombok */
|
2022-03-07 09:34:54 +00:00
|
|
|
public abstract class ConfigurationFile {
|
|
|
|
private static final String LOMBOK_CONFIG_FILENAME = "lombok.config";
|
|
|
|
private final String identifier;
|
|
|
|
private static final Pattern VARIABLE = Pattern.compile("\\<(.+?)\\>");
|
|
|
|
private static final Map<String, String> ENV = new HashMap(System.getenv());
|
|
|
|
private static final ThreadLocal<byte[]> buffers = new AnonymousClass1();
|
|
|
|
|
|
|
|
/* renamed from: lombok.core.configuration.ConfigurationFile$1 reason: invalid class name */
|
2022-03-08 19:23:59 +00:00
|
|
|
/* loaded from: com.discord-118106.apk:lombok/core/configuration/ConfigurationFile$1.SCL.lombok */
|
2022-03-07 09:34:54 +00:00
|
|
|
class AnonymousClass1 extends ThreadLocal<byte[]> {
|
|
|
|
AnonymousClass1() {
|
|
|
|
}
|
|
|
|
|
|
|
|
/* JADX INFO: Access modifiers changed from: protected */
|
|
|
|
/* JADX WARN: Can't rename method to resolve collision */
|
|
|
|
@Override // java.lang.ThreadLocal
|
|
|
|
public byte[] initialValue() {
|
|
|
|
return new byte[65536];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-08 19:23:59 +00:00
|
|
|
/* loaded from: com.discord-118106.apk:lombok/core/configuration/ConfigurationFile$ArchivedConfigurationFile.SCL.lombok */
|
2022-03-07 09:34:54 +00:00
|
|
|
private static class ArchivedConfigurationFile extends ConfigurationFile {
|
|
|
|
private static final URI ROOT1 = URI.create("http://x.y/a/");
|
|
|
|
private static final URI ROOT2 = URI.create("ftp://y.x/b/");
|
|
|
|
private static final ConcurrentMap<String, Object> locks = new ConcurrentHashMap();
|
|
|
|
private final File archive;
|
|
|
|
private final URI file;
|
|
|
|
private final Object lock;
|
|
|
|
private long lastModified = -2;
|
|
|
|
private String contents;
|
|
|
|
|
|
|
|
public static ConfigurationFile create(File file, URI uri) {
|
|
|
|
if (!isRelative(uri)) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
return new ArchivedConfigurationFile(file, uri, String.valueOf(file.getPath()) + "!" + uri.getPath());
|
|
|
|
}
|
|
|
|
|
|
|
|
static boolean isRelative(URI uri) {
|
|
|
|
try {
|
|
|
|
if (ROOT1.resolve(uri).toString().startsWith(ROOT1.toString())) {
|
|
|
|
return ROOT2.resolve(uri).toString().startsWith(ROOT2.toString());
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
} catch (Exception unused) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ArchivedConfigurationFile(File file, URI uri, String str) {
|
|
|
|
super(str, null);
|
|
|
|
this.archive = file;
|
|
|
|
this.file = uri;
|
|
|
|
locks.putIfAbsent(file.getPath(), new Object());
|
|
|
|
this.lock = locks.get(file.getPath());
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // lombok.core.configuration.ConfigurationFile
|
|
|
|
long getLastModifiedOrMissing() {
|
|
|
|
return getLastModifiedOrMissing(this.archive);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
|
|
/* JADX WARN: Unknown variable types count: 1 */
|
|
|
|
@Override // lombok.core.configuration.ConfigurationFile
|
|
|
|
/*
|
|
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
|
|
*/
|
|
|
|
boolean exists() {
|
|
|
|
boolean z2;
|
|
|
|
if (!ConfigurationFile.access$1(this.archive)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
?? r0 = this.lock;
|
|
|
|
synchronized (r0) {
|
|
|
|
try {
|
|
|
|
readIfNeccesary();
|
|
|
|
r0 = this.contents;
|
|
|
|
z2 = r0 != 0;
|
|
|
|
} catch (Exception unused) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return z2;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
|
|
/* JADX WARN: Unknown variable types count: 1 */
|
|
|
|
@Override // lombok.core.configuration.ConfigurationFile
|
|
|
|
/*
|
|
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
|
|
*/
|
|
|
|
CharSequence contents() throws IOException {
|
|
|
|
?? r0 = this.lock;
|
|
|
|
synchronized (r0) {
|
|
|
|
readIfNeccesary();
|
|
|
|
r0 = this.contents;
|
|
|
|
}
|
|
|
|
return r0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void readIfNeccesary() throws IOException {
|
|
|
|
long lastModifiedOrMissing = getLastModifiedOrMissing();
|
|
|
|
if (lastModifiedOrMissing != this.lastModified) {
|
|
|
|
this.contents = null;
|
|
|
|
this.lastModified = lastModifiedOrMissing;
|
|
|
|
if (lastModifiedOrMissing != -88) {
|
|
|
|
this.contents = read();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* JADX WARN: Finally extract failed */
|
|
|
|
private String read() throws IOException {
|
|
|
|
ZipEntry nextEntry;
|
|
|
|
FileInputStream fileInputStream = new FileInputStream(this.archive);
|
|
|
|
try {
|
|
|
|
ZipInputStream zipInputStream = new ZipInputStream(fileInputStream);
|
|
|
|
do {
|
|
|
|
nextEntry = zipInputStream.getNextEntry();
|
|
|
|
if (nextEntry == null) {
|
|
|
|
zipInputStream.close();
|
|
|
|
fileInputStream.close();
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
} while (!nextEntry.getName().equals(this.file.getPath()));
|
|
|
|
String access$2 = ConfigurationFile.access$2(zipInputStream);
|
|
|
|
zipInputStream.close();
|
|
|
|
fileInputStream.close();
|
|
|
|
return access$2;
|
|
|
|
} catch (Throwable th) {
|
|
|
|
fileInputStream.close();
|
|
|
|
throw th;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // lombok.core.configuration.ConfigurationFile
|
|
|
|
public ConfigurationFile resolve(String str) {
|
|
|
|
try {
|
|
|
|
URI resolve = this.file.resolve(str);
|
|
|
|
if (!isRelative(resolve)) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
return create(this.archive, resolve);
|
|
|
|
} catch (Exception unused) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // lombok.core.configuration.ConfigurationFile
|
|
|
|
ConfigurationFile parent() {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-08 19:23:59 +00:00
|
|
|
/* loaded from: com.discord-118106.apk:lombok/core/configuration/ConfigurationFile$CharSequenceConfigurationFile.SCL.lombok */
|
2022-03-07 09:34:54 +00:00
|
|
|
private static class CharSequenceConfigurationFile extends ConfigurationFile {
|
|
|
|
private final CharSequence contents;
|
|
|
|
private final long lastModified;
|
|
|
|
|
|
|
|
private CharSequenceConfigurationFile(String str, CharSequence charSequence, long j) {
|
|
|
|
super(str, null);
|
|
|
|
this.contents = charSequence;
|
|
|
|
this.lastModified = j;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // lombok.core.configuration.ConfigurationFile
|
|
|
|
long getLastModifiedOrMissing() {
|
|
|
|
return this.lastModified;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // lombok.core.configuration.ConfigurationFile
|
|
|
|
CharSequence contents() throws IOException {
|
|
|
|
return this.contents;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // lombok.core.configuration.ConfigurationFile
|
|
|
|
boolean exists() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // lombok.core.configuration.ConfigurationFile
|
|
|
|
public ConfigurationFile resolve(String str) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // lombok.core.configuration.ConfigurationFile
|
|
|
|
ConfigurationFile parent() {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* synthetic */ CharSequenceConfigurationFile(String str, CharSequence charSequence, long j, CharSequenceConfigurationFile charSequenceConfigurationFile) {
|
|
|
|
this(str, charSequence, j);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-08 19:23:59 +00:00
|
|
|
/* loaded from: com.discord-118106.apk:lombok/core/configuration/ConfigurationFile$RegularConfigurationFile.SCL.lombok */
|
2022-03-07 09:34:54 +00:00
|
|
|
private static class RegularConfigurationFile extends ConfigurationFile {
|
|
|
|
private final File file;
|
|
|
|
|
|
|
|
private RegularConfigurationFile(File file) {
|
|
|
|
super(file.getPath(), null);
|
|
|
|
this.file = file;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // lombok.core.configuration.ConfigurationFile
|
|
|
|
boolean exists() {
|
|
|
|
return ConfigurationFile.access$1(this.file);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // lombok.core.configuration.ConfigurationFile
|
|
|
|
public ConfigurationFile resolve(String str) {
|
|
|
|
if (str.endsWith("!")) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
String[] split = str.split("!");
|
|
|
|
if (split.length > 2) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
String str2 = split[0];
|
|
|
|
File resolveFile = resolveFile(replaceEnvironmentVariables(str2));
|
|
|
|
if (str2.endsWith(".zip") || str2.endsWith(".jar")) {
|
|
|
|
try {
|
|
|
|
return ArchivedConfigurationFile.create(resolveFile, URI.create(split.length == 1 ? ConfigurationFile.LOMBOK_CONFIG_FILENAME : split[1]));
|
|
|
|
} catch (Exception unused) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
} else if (split.length <= 1 && resolveFile != null) {
|
|
|
|
return forFile(resolveFile);
|
|
|
|
} else {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private File resolveFile(String str) {
|
|
|
|
char lowerCase;
|
|
|
|
boolean z2 = false;
|
|
|
|
int indexOf = str.indexOf(58);
|
|
|
|
if (indexOf != -1) {
|
|
|
|
if (indexOf != 1 || str.indexOf(58, indexOf + 1) != -1 || (lowerCase = Character.toLowerCase(str.charAt(0))) < 'a' || lowerCase > 'z') {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
z2 = true;
|
|
|
|
}
|
|
|
|
if (str.charAt(0) == '/') {
|
|
|
|
z2 = true;
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
return z2 ? new File(str) : new File(this.file.toURI().resolve(str));
|
|
|
|
} catch (Exception unused) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // lombok.core.configuration.ConfigurationFile
|
|
|
|
long getLastModifiedOrMissing() {
|
|
|
|
return getLastModifiedOrMissing(this.file);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // lombok.core.configuration.ConfigurationFile
|
|
|
|
CharSequence contents() throws IOException {
|
|
|
|
FileInputStream fileInputStream = new FileInputStream(this.file);
|
|
|
|
try {
|
|
|
|
return ConfigurationFile.access$2(fileInputStream);
|
|
|
|
} finally {
|
|
|
|
fileInputStream.close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // lombok.core.configuration.ConfigurationFile
|
|
|
|
ConfigurationFile parent() {
|
|
|
|
File parentFile = this.file.getParentFile().getParentFile();
|
|
|
|
if (parentFile == null) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
return forDirectory(parentFile);
|
|
|
|
}
|
|
|
|
|
|
|
|
private static String replaceEnvironmentVariables(String str) {
|
|
|
|
int i = 0;
|
|
|
|
StringBuffer stringBuffer = new StringBuffer();
|
|
|
|
if (str.startsWith("~")) {
|
|
|
|
i = 1;
|
|
|
|
stringBuffer.append(System.getProperty("user.home", "~"));
|
|
|
|
}
|
|
|
|
Matcher matcher = ConfigurationFile.access$3().matcher(str.substring(i));
|
|
|
|
while (matcher.find()) {
|
|
|
|
String group = matcher.group(1);
|
|
|
|
String str2 = (String) ConfigurationFile.access$4().get(group);
|
|
|
|
if (str2 == null) {
|
|
|
|
str2 = "<" + group + ">";
|
|
|
|
}
|
|
|
|
matcher.appendReplacement(stringBuffer, str2);
|
|
|
|
}
|
|
|
|
matcher.appendTail(stringBuffer);
|
|
|
|
return stringBuffer.toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* synthetic */ RegularConfigurationFile(File file, RegularConfigurationFile regularConfigurationFile) {
|
|
|
|
this(file);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void setEnvironment(String str, String str2) {
|
|
|
|
ENV.put(str, str2);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static ConfigurationFile forFile(File file) {
|
|
|
|
return new RegularConfigurationFile(file, null);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static ConfigurationFile forDirectory(File file) {
|
|
|
|
return forFile(new File(file, LOMBOK_CONFIG_FILENAME));
|
|
|
|
}
|
|
|
|
|
|
|
|
public static ConfigurationFile fromCharSequence(String str, CharSequence charSequence, long j) {
|
|
|
|
return new CharSequenceConfigurationFile(str, charSequence, j, null);
|
|
|
|
}
|
|
|
|
|
|
|
|
private ConfigurationFile(String str) {
|
|
|
|
this.identifier = str;
|
|
|
|
}
|
|
|
|
|
|
|
|
abstract long getLastModifiedOrMissing();
|
|
|
|
|
|
|
|
abstract boolean exists();
|
|
|
|
|
|
|
|
abstract CharSequence contents() throws IOException;
|
|
|
|
|
|
|
|
public abstract ConfigurationFile resolve(String str);
|
|
|
|
|
|
|
|
abstract ConfigurationFile parent();
|
|
|
|
|
|
|
|
final String description() {
|
|
|
|
return this.identifier;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final boolean equals(Object obj) {
|
|
|
|
if (!(obj instanceof ConfigurationFile)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return this.identifier.equals(((ConfigurationFile) obj).identifier);
|
|
|
|
}
|
|
|
|
|
|
|
|
public final int hashCode() {
|
|
|
|
return this.identifier.hashCode();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static long getLastModifiedOrMissing(File file) {
|
|
|
|
if (!fileExists(file)) {
|
|
|
|
return -88L;
|
|
|
|
}
|
|
|
|
return file.lastModified();
|
|
|
|
}
|
|
|
|
|
|
|
|
private static boolean fileExists(File file) {
|
|
|
|
return file.exists() && file.isFile();
|
|
|
|
}
|
|
|
|
|
|
|
|
private static String read(InputStream inputStream) throws IOException {
|
|
|
|
byte[] bArr = buffers.get();
|
|
|
|
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
|
|
|
while (true) {
|
|
|
|
int read = inputStream.read(bArr);
|
|
|
|
if (read == -1) {
|
|
|
|
return new String(byteArrayOutputStream.toByteArray(), Constants.ENCODING);
|
|
|
|
}
|
|
|
|
byteArrayOutputStream.write(bArr, 0, read);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* synthetic */ ConfigurationFile(String str, ConfigurationFile configurationFile) {
|
|
|
|
this(str);
|
|
|
|
}
|
|
|
|
|
|
|
|
static /* synthetic */ boolean access$1(File file) {
|
|
|
|
return fileExists(file);
|
|
|
|
}
|
|
|
|
|
|
|
|
static /* synthetic */ String access$2(InputStream inputStream) throws IOException {
|
|
|
|
return read(inputStream);
|
|
|
|
}
|
|
|
|
|
|
|
|
static /* synthetic */ Pattern access$3() {
|
|
|
|
return VARIABLE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static /* synthetic */ Map access$4() {
|
|
|
|
return ENV;
|
|
|
|
}
|
|
|
|
}
|