All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.openrewrite.protobuf.tree.Proto Maven / Gradle / Ivy

There is a newer version: 8.40.2
Show newest version
/*
 * Copyright 2021 the original author or authors.
 * 

* Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at *

* https://www.apache.org/licenses/LICENSE-2.0 *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.openrewrite.protobuf.tree; import lombok.*; import lombok.experimental.FieldDefaults; import lombok.experimental.NonFinal; import org.jspecify.annotations.Nullable; import org.openrewrite.*; import org.openrewrite.marker.Markers; import org.openrewrite.protobuf.ProtoVisitor; import org.openrewrite.protobuf.internal.ProtoPrinter; import java.lang.ref.WeakReference; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.nio.file.Path; import java.util.List; import java.util.UUID; public interface Proto extends Tree { @SuppressWarnings("unchecked") @Override default R accept(TreeVisitor v, P p) { return (R) acceptProto(v.adapt(ProtoVisitor.class), p); } default

@Nullable Proto acceptProto(ProtoVisitor

v, P p) { return v.defaultValue(this, p); } @Override default

boolean isAcceptable(TreeVisitor v, P p) { return v.isAdaptableTo(ProtoVisitor.class); } Space getPrefix();

P withPrefix(Space prefix); @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) @EqualsAndHashCode(callSuper = false, onlyExplicitlyIncluded = true) @RequiredArgsConstructor @AllArgsConstructor(access = AccessLevel.PRIVATE) class Block implements Proto { @Nullable @NonFinal transient WeakReference padding; @With @EqualsAndHashCode.Include @Getter UUID id; @With @Getter Space prefix; @With @Getter Markers markers; List> statements; @With @Getter Space end; public List getStatements() { return ProtoRightPadded.getElements(statements); } public Block withStatements(List statements) { return getPadding().withStatements(ProtoRightPadded.withElements(this.statements, statements)); } @Override public

Proto acceptProto(ProtoVisitor

v, P p) { return v.visitBlock(this, p); } public Padding getPadding() { Padding p; if (this.padding == null) { p = new Padding(this); this.padding = new WeakReference<>(p); } else { p = this.padding.get(); if (p == null || p.t != this) { p = new Padding(this); this.padding = new WeakReference<>(p); } } return p; } @RequiredArgsConstructor public static class Padding { private final Block t; public List> getStatements() { return t.statements; } public Block withStatements(List> statements) { return t.statements == statements ? t : new Block(t.id, t.prefix, t.markers, statements, t.end); } } } @Value @With @EqualsAndHashCode(callSuper = false, onlyExplicitlyIncluded = true) class Constant implements Proto { @EqualsAndHashCode.Include UUID id; Space prefix; Markers markers; Object value; String valueSource; @Override public

Proto acceptProto(ProtoVisitor

v, P p) { return v.visitConstant(this, p); } } @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) @EqualsAndHashCode(callSuper = false, onlyExplicitlyIncluded = true) @RequiredArgsConstructor @AllArgsConstructor(access = AccessLevel.PRIVATE) class Document implements Proto, SourceFile { @Nullable @NonFinal transient WeakReference padding; @With @EqualsAndHashCode.Include @Getter UUID id; @With @Getter Path sourcePath; @With @Getter @Nullable FileAttributes fileAttributes; @With @Getter Space prefix; @With @Getter Markers markers; @Nullable // for backwards compatibility @With(AccessLevel.PRIVATE) String charsetName; @With @Getter boolean charsetBomMarked; @With @Getter @Nullable Checksum checksum; @Override public Charset getCharset() { return charsetName == null ? StandardCharsets.UTF_8 : Charset.forName(charsetName); } @Override public SourceFile withCharset(Charset charset) { return withCharsetName(charset.name()); } @With @Getter Syntax syntax; List> body; public List getBody() { return ProtoRightPadded.getElements(body); } public Document withBody(List body) { return getPadding().withBody(ProtoRightPadded.withElements(this.body, body)); } @With @Getter Space eof; @Override public

Proto acceptProto(ProtoVisitor

v, P p) { return v.visitDocument(this, p); } @Override public

TreeVisitor> printer(Cursor cursor) { return new ProtoPrinter<>(); } public Padding getPadding() { Padding p; if (this.padding == null) { p = new Padding(this); this.padding = new WeakReference<>(p); } else { p = this.padding.get(); if (p == null || p.t != this) { p = new Padding(this); this.padding = new WeakReference<>(p); } } return p; } @RequiredArgsConstructor public static class Padding { private final Document t; public List> getBody() { return t.body; } public Document withBody(List> body) { return t.body == body ? t : new Document(t.id, t.sourcePath, t.fileAttributes, t.prefix, t.markers, t.charsetName, t.charsetBomMarked, t.checksum, t.syntax, body, t.eof); } } } @Value @EqualsAndHashCode(callSuper = false, onlyExplicitlyIncluded = true) @With class Empty implements Proto { @EqualsAndHashCode.Include UUID id; Space prefix; Markers markers; @Override public

Proto acceptProto(ProtoVisitor

v, P p) { return v.visitEmpty(this, p); } } @Value @EqualsAndHashCode(callSuper = false, onlyExplicitlyIncluded = true) @With class Enum implements Proto { @EqualsAndHashCode.Include UUID id; Space prefix; Markers markers; Identifier name; Block body; @Override public

Proto acceptProto(ProtoVisitor

v, P p) { return v.visitEnum(this, p); } } @Value @EqualsAndHashCode(callSuper = false, onlyExplicitlyIncluded = true) @With class Extend implements Proto { @EqualsAndHashCode.Include UUID id; Space prefix; Markers markers; FullIdentifier name; Block body; @Override public

Proto acceptProto(ProtoVisitor

v, P p) { return v.visitExtend(this, p); } } @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) @EqualsAndHashCode(callSuper = false, onlyExplicitlyIncluded = true) @RequiredArgsConstructor @AllArgsConstructor(access = AccessLevel.PRIVATE) class Field implements FullName { @Nullable @NonFinal transient WeakReference padding; @With @EqualsAndHashCode.Include @Getter UUID id; @With @Getter Space prefix; @With @Getter Markers markers; /** * Required for a regular field, and required to be null for a oneof field. */ @Nullable @With @Getter Keyword label; @With @Getter TypeTree type; ProtoRightPadded name; public Identifier getName() { return name.getElement(); } public Field withName(Identifier fieldName) { return getPadding().withName(this.name.withElement(fieldName)); } @With @Getter Constant number; @Nullable ProtoContainer

Proto acceptProto(ProtoVisitor

v, P p) { return v.visitField(this, p); } public Padding getPadding() { Padding p; if (this.padding == null) { p = new Padding(this); this.padding = new WeakReference<>(p); } else { p = this.padding.get(); if (p == null || p.t != this) { p = new Padding(this); this.padding = new WeakReference<>(p); } } return p; } @RequiredArgsConstructor public static class Padding { private final Field t; public ProtoRightPadded getName() { return t.name; } public Field withName(ProtoRightPadded name) { return t.name == name ? t : new Field(t.id, t.prefix, t.markers, t.label, t.type, name, t.number, t.options); } public @Nullable ProtoContainer

Proto acceptProto(ProtoVisitor

v, P p) { return v.visitExtensionName(this, p); } public Padding getPadding() { Padding p; if (this.padding == null) { p = new Padding(this); this.padding = new WeakReference<>(p); } else { p = this.padding.get(); if (p == null || p.t != this) { p = new Padding(this); this.padding = new WeakReference<>(p); } } return p; } @RequiredArgsConstructor public static class Padding { private final ExtensionName t; public ProtoRightPadded getExtension() { return t.extension; } public ExtensionName withExtension(ProtoRightPadded extension) { return t.extension == extension ? t : new ExtensionName(t.id, t.prefix, t.markers, extension); } } } @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) @EqualsAndHashCode(callSuper = false, onlyExplicitlyIncluded = true) @RequiredArgsConstructor @AllArgsConstructor(access = AccessLevel.PRIVATE) class EnumField implements Proto { @Nullable @NonFinal transient WeakReference padding; @With @EqualsAndHashCode.Include @Getter UUID id; @With @Getter Space prefix; @With @Getter Markers markers; ProtoRightPadded name; public Identifier getName() { return name.getElement(); } public EnumField withName(Identifier fieldName) { return getPadding().withName(this.name.withElement(fieldName)); } @With @Getter Constant number; @Nullable ProtoContainer

Proto acceptProto(ProtoVisitor

v, P p) { return v.visitEnumField(this, p); } public Padding getPadding() { Padding p; if (this.padding == null) { p = new Padding(this); this.padding = new WeakReference<>(p); } else { p = this.padding.get(); if (p == null || p.t != this) { p = new Padding(this); this.padding = new WeakReference<>(p); } } return p; } @RequiredArgsConstructor public static class Padding { private final EnumField t; public ProtoRightPadded getName() { return t.name; } public EnumField withName(ProtoRightPadded name) { return t.name == name ? t : new EnumField(t.id, t.prefix, t.markers, name, t.number, t.options); } public @Nullable ProtoContainer

Proto acceptProto(ProtoVisitor

v, P p) { return v.visitFullIdentifier(this, p); } public Padding getPadding() { Padding p; if (this.padding == null) { p = new Padding(this); this.padding = new WeakReference<>(p); } else { p = this.padding.get(); if (p == null || p.t != this) { p = new Padding(this); this.padding = new WeakReference<>(p); } } return p; } @RequiredArgsConstructor public static class Padding { private final FullIdentifier t; public @Nullable ProtoRightPadded getTarget() { return t.target; } public FullIdentifier withTarget(@Nullable ProtoRightPadded target) { return t.target == target ? t : new FullIdentifier(t.id, t.prefix, t.markers, target, t.name); } } } @Value @EqualsAndHashCode(callSuper = false, onlyExplicitlyIncluded = true) @With class Identifier implements Proto { @EqualsAndHashCode.Include UUID id; Space prefix; Markers markers; String name; @Override public

Proto acceptProto(ProtoVisitor

v, P p) { return v.visitIdentifier(this, p); } } @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) @EqualsAndHashCode(callSuper = false, onlyExplicitlyIncluded = true) @RequiredArgsConstructor @AllArgsConstructor(access = AccessLevel.PRIVATE) class Import implements Proto { @Nullable @NonFinal transient WeakReference padding; @EqualsAndHashCode.Include @With @Getter UUID id; @With @Getter Space prefix; @With @Getter Markers markers; @With @Getter @Nullable Keyword modifier; ProtoRightPadded name; public StringLiteral getName() { return name.getElement(); } public Import withName(StringLiteral name) { return getPadding().withName(this.name.withElement(name)); } @Override public

Proto acceptProto(ProtoVisitor

v, P p) { return v.visitImport(this, p); } public Padding getPadding() { Padding p; if (this.padding == null) { p = new Padding(this); this.padding = new WeakReference<>(p); } else { p = this.padding.get(); if (p == null || p.t != this) { p = new Padding(this); this.padding = new WeakReference<>(p); } } return p; } @RequiredArgsConstructor public static class Padding { private final Import t; public ProtoRightPadded getName() { return t.name; } public Import withName(ProtoRightPadded name) { return t.name == name ? t : new Import(t.id, t.prefix, t.markers, t.modifier, name); } } } @Value @EqualsAndHashCode(callSuper = false, onlyExplicitlyIncluded = true) @With class Keyword implements Proto { @EqualsAndHashCode.Include UUID id; Space prefix; Markers markers; String keyword; @Override public

Proto acceptProto(ProtoVisitor

v, P p) { return v.visitKeyword(this, p); } } @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) @EqualsAndHashCode(callSuper = false, onlyExplicitlyIncluded = true) @RequiredArgsConstructor @AllArgsConstructor(access = AccessLevel.PRIVATE) class MapField implements Proto { @Nullable @NonFinal transient WeakReference padding; @With @EqualsAndHashCode.Include @Getter UUID id; @With @Getter Space prefix; @With @Getter Markers markers; ProtoRightPadded map; ProtoRightPadded keyType; public Keyword getKeyType() { return keyType.getElement(); } public MapField withKeyType(Keyword keyType) { return getPadding().withKeyType(getPadding().getKeyType().withElement(keyType)); } ProtoRightPadded valueType; public TypeTree getValueType() { return valueType.getElement(); } public MapField withValueType(TypeTree valueType) { return getPadding().withValueType(getPadding().getValueType().withElement(valueType)); } ProtoRightPadded name; public Identifier getName() { return name.getElement(); } public MapField withName(Identifier name) { return getPadding().withName(getPadding().getName().withElement(name)); } @With @Getter Constant number; @Nullable ProtoContainer

Proto acceptProto(ProtoVisitor

v, P p) { return v.visitMapField(this, p); } public Padding getPadding() { Padding p; if (this.padding == null) { p = new Padding(this); this.padding = new WeakReference<>(p); } else { p = this.padding.get(); if (p == null || p.t != this) { p = new Padding(this); this.padding = new WeakReference<>(p); } } return p; } @RequiredArgsConstructor public static class Padding { private final MapField t; public ProtoRightPadded getMap() { return t.map; } public MapField withMap(ProtoRightPadded map) { return t.map == map ? t : new MapField(t.id, t.prefix, t.markers, map, t.keyType, t.valueType, t.name, t.number, t.options); } public ProtoRightPadded getKeyType() { return t.keyType; } public MapField withKeyType(ProtoRightPadded keyType) { return t.keyType == keyType ? t : new MapField(t.id, t.prefix, t.markers, t.map, keyType, t.valueType, t.name, t.number, t.options); } public ProtoRightPadded getValueType() { return t.valueType; } public MapField withValueType(ProtoRightPadded valueType) { return t.valueType == valueType ? t : new MapField(t.id, t.prefix, t.markers, t.map, t.keyType, valueType, t.name, t.number, t.options); } public ProtoRightPadded getName() { return t.name; } public MapField withName(ProtoRightPadded name) { return t.name == name ? t : new MapField(t.id, t.prefix, t.markers, t.map, t.keyType, t.valueType, name, t.number, t.options); } public @Nullable ProtoContainer

Proto acceptProto(ProtoVisitor

v, P p) { return v.visitMessage(this, p); } } @Value @EqualsAndHashCode(callSuper = false, onlyExplicitlyIncluded = true) @With class OneOf implements Proto { @EqualsAndHashCode.Include UUID id; Space prefix; Markers markers; Identifier name; Block fields; @Override public

Proto acceptProto(ProtoVisitor

v, P p) { return v.visitOneOf(this, p); } } @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) @EqualsAndHashCode(callSuper = false, onlyExplicitlyIncluded = true) @RequiredArgsConstructor @AllArgsConstructor(access = AccessLevel.PRIVATE) class Option implements Proto { @Nullable @NonFinal transient WeakReference padding; @With @EqualsAndHashCode.Include @Getter UUID id; @With @Getter Space prefix; @With @Getter Markers markers; ProtoRightPadded name; public FullName getName() { return name.getElement(); } public Field.Option withName(FullName name) { return getPadding().withName(getPadding().getName().withElement(name)); } @With @Getter Constant assignment; @Override public

Proto acceptProto(ProtoVisitor

v, P p) { return v.visitOption(this, p); } public Padding getPadding() { Padding p; if (this.padding == null) { p = new Padding(this); this.padding = new WeakReference<>(p); } else { p = this.padding.get(); if (p == null || p.t != this) { p = new Padding(this); this.padding = new WeakReference<>(p); } } return p; } @RequiredArgsConstructor public static class Padding { private final Field.Option t; public ProtoRightPadded getName() { return t.name; } public Field.Option withName(ProtoRightPadded name) { return t.name == name ? t : new Field.Option(t.id, t.prefix, t.markers, name, t.assignment); } } } @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) @EqualsAndHashCode(callSuper = false, onlyExplicitlyIncluded = true) @RequiredArgsConstructor @AllArgsConstructor(access = AccessLevel.PRIVATE) class OptionDeclaration implements Proto { @Nullable @NonFinal transient WeakReference padding; @With @EqualsAndHashCode.Include @Getter UUID id; @With @Getter Space prefix; @With @Getter Markers markers; ProtoRightPadded name; @With @Getter Constant assignment; @Override public

Proto acceptProto(ProtoVisitor

v, P p) { return v.visitOptionDeclaration(this, p); } public FullName getName() { return name.getElement(); } public OptionDeclaration withName(FullName name) { return getPadding().withName(this.name.withElement(name)); } public Padding getPadding() { Padding p; if (this.padding == null) { p = new Padding(this); this.padding = new WeakReference<>(p); } else { p = this.padding.get(); if (p == null || p.t != this) { p = new Padding(this); this.padding = new WeakReference<>(p); } } return p; } @RequiredArgsConstructor public static class Padding { private final OptionDeclaration t; public ProtoRightPadded getName() { return t.name; } public OptionDeclaration withName(ProtoRightPadded name) { return t.name == name ? t : new OptionDeclaration(t.id, t.prefix, t.markers, name, t.assignment); } } } @Value @EqualsAndHashCode(callSuper = false, onlyExplicitlyIncluded = true) @With class Package implements Proto { @EqualsAndHashCode.Include UUID id; Space prefix; Markers markers; FullIdentifier name; @Override public

Proto acceptProto(ProtoVisitor

v, P p) { return v.visitPackage(this, p); } } @Value @EqualsAndHashCode(callSuper = false, onlyExplicitlyIncluded = true) @With class Primitive implements TypeTree { @EqualsAndHashCode.Include UUID id; Space prefix; Markers markers; Type type; public enum Type { DOUBLE, FLOAT, INT32, INT64, UINT32, UINT64, SINT32, SINT64, FIXED32, FIXED64, SFIXED32, SFIXED64, BOOL, STRING, BYTES } @Override public

Proto acceptProto(ProtoVisitor

v, P p) { return v.visitPrimitive(this, p); } } @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) @EqualsAndHashCode(callSuper = false, onlyExplicitlyIncluded = true) @RequiredArgsConstructor @AllArgsConstructor(access = AccessLevel.PRIVATE) class Range implements Proto { @Nullable @NonFinal transient WeakReference padding; @With @EqualsAndHashCode.Include @Getter UUID id; @With @Getter Space prefix; @With @Getter Markers markers; ProtoRightPadded from; @With @Getter Constant to; @Override public

Proto acceptProto(ProtoVisitor

v, P p) { return v.visitRange(this, p); } public Constant getFrom() { return from.getElement(); } public Range withFrom(Constant from) { return getPadding().withFrom(this.from.withElement(from)); } public Padding getPadding() { Padding p; if (this.padding == null) { p = new Padding(this); this.padding = new WeakReference<>(p); } else { p = this.padding.get(); if (p == null || p.t != this) { p = new Padding(this); this.padding = new WeakReference<>(p); } } return p; } @RequiredArgsConstructor public static class Padding { private final Range t; public ProtoRightPadded getFrom() { return t.from; } public Range withFrom(ProtoRightPadded from) { return t.from == from ? t : new Range(t.id, t.prefix, t.markers, from, t.to); } } } @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) @EqualsAndHashCode(callSuper = false, onlyExplicitlyIncluded = true) @RequiredArgsConstructor @AllArgsConstructor(access = AccessLevel.PRIVATE) class Reserved implements Proto { @Nullable @NonFinal transient WeakReference padding; @With @EqualsAndHashCode.Include @Getter UUID id; @With @Getter Space prefix; @With @Getter Markers markers; /** * Either a set of string literal {@link Constant} or a set of {@link Range} */ @Nullable ProtoContainer reservations; public @Nullable List getReservations() { return reservations == null ? null : reservations.getElements(); } public Reserved withReservations(@Nullable List reservations) { return getPadding().withReservations(ProtoContainer.withElementsNullable(this.reservations, reservations)); } @Override public

Proto acceptProto(ProtoVisitor

v, P p) { return v.visitReserved(this, p); } public Padding getPadding() { Padding p; if (this.padding == null) { p = new Padding(this); this.padding = new WeakReference<>(p); } else { p = this.padding.get(); if (p == null || p.t != this) { p = new Padding(this); this.padding = new WeakReference<>(p); } } return p; } @RequiredArgsConstructor public static class Padding { private final Reserved t; public @Nullable ProtoContainer getReservations() { return t.reservations; } public Reserved withReservations(@Nullable ProtoContainer reservations) { return t.reservations == reservations ? t : new Reserved(t.id, t.prefix, t.markers, reservations); } } } @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) @EqualsAndHashCode(callSuper = false, onlyExplicitlyIncluded = true) @RequiredArgsConstructor @AllArgsConstructor(access = AccessLevel.PRIVATE) class RpcInOut implements Proto { @Nullable @NonFinal transient WeakReference padding; @With @EqualsAndHashCode.Include @Getter UUID id; @With @Getter Space prefix; @With @Getter Markers markers; @Nullable @With @Getter Keyword stream; ProtoRightPadded type; public FullName getType() { return type.getElement(); } public RpcInOut withType(FullName type) { return getPadding().withType(this.type.withElement(type)); } @Override public

Proto acceptProto(ProtoVisitor

v, P p) { return v.visitRpcInOut(this, p); } public Padding getPadding() { Padding p; if (this.padding == null) { p = new Padding(this); this.padding = new WeakReference<>(p); } else { p = this.padding.get(); if (p == null || p.t != this) { p = new Padding(this); this.padding = new WeakReference<>(p); } } return p; } @RequiredArgsConstructor public static class Padding { private final RpcInOut t; public @Nullable ProtoRightPadded getType() { return t.type; } public RpcInOut withType(@Nullable ProtoRightPadded type) { return t.type == type ? t : new RpcInOut(t.id, t.prefix, t.markers, t.stream, type); } } } @Value @EqualsAndHashCode(callSuper = false, onlyExplicitlyIncluded = true) @With class Rpc implements Proto { @EqualsAndHashCode.Include UUID id; Space prefix; Markers markers; Identifier name; RpcInOut request; Keyword returns; RpcInOut response; @Nullable Block body; @Override public

Proto acceptProto(ProtoVisitor

v, P p) { return v.visitRpc(this, p); } } @Value @EqualsAndHashCode(callSuper = false, onlyExplicitlyIncluded = true) @With class Service implements Proto { @EqualsAndHashCode.Include UUID id; Space prefix; Markers markers; Identifier name; Block body; @Override public

Proto acceptProto(ProtoVisitor

v, P p) { return v.visitService(this, p); } } @Value @EqualsAndHashCode(callSuper = false, onlyExplicitlyIncluded = true) @With class StringLiteral implements Proto { @EqualsAndHashCode.Include UUID id; Space prefix; Markers markers; boolean singleQuote; String literal; @Override public

Proto acceptProto(ProtoVisitor

v, P p) { return v.visitStringLiteral(this, p); } } @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) @EqualsAndHashCode(callSuper = false, onlyExplicitlyIncluded = true) @RequiredArgsConstructor @AllArgsConstructor(access = AccessLevel.PRIVATE) class Syntax implements Proto { @Nullable @NonFinal transient WeakReference padding; @With @EqualsAndHashCode.Include @Getter UUID id; @With @Getter Space prefix; @With @Getter Markers markers; @With @Getter Space keywordSuffix; ProtoRightPadded level; public Constant getLevel() { return level.getElement(); } public Syntax withLevel(Constant level) { return getPadding().withLevel(this.level.withElement(level)); } public int getLevelVersion() { return level.getElement().getValueSource().contains("2") ? 2 : 3; } @Override public

Proto acceptProto(ProtoVisitor

v, P p) { return v.visitSyntax(this, p); } public Padding getPadding() { Padding p; if (this.padding == null) { p = new Padding(this); this.padding = new WeakReference<>(p); } else { p = this.padding.get(); if (p == null || p.t != this) { p = new Padding(this); this.padding = new WeakReference<>(p); } } return p; } @RequiredArgsConstructor public static class Padding { private final Syntax t; public ProtoRightPadded getLevel() { return t.level; } public Syntax withLevel(ProtoRightPadded level) { return t.level == level ? t : new Syntax(t.id, t.prefix, t.markers, t.keywordSuffix, level); } } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy