Skip to content

Commit

Permalink
style: google-java-format Java files (#5892)
Browse files Browse the repository at this point in the history
  • Loading branch information
schroederc committed Oct 12, 2023
1 parent bca72ab commit 9953914
Show file tree
Hide file tree
Showing 64 changed files with 1,537 additions and 1,556 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1488,6 +1488,7 @@ private EntrySet emitAnchor(TreeContext anchorContext, EdgeKind kind, VName node
}
return emitAnchor(anchor, kind, node, scope);
}

// Creates/emits an anchor and an associated edge
private @Nullable EntrySet emitAnchor(
EntrySet anchor, EdgeKind kind, VName node, List<VName> scope) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ public class InputUsageRecord {

private boolean isUsed = false;

/** @param location of a java file object, if known. */
/**
* @param location of a java file object, if known.
*/
public InputUsageRecord(JavaFileObject fileObject, Optional<Location> location) {
this.fileObject = checkNotNull(fileObject);
this.location = checkNotNull(location);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ public TreePath getPath(Element e) {
public boolean getUseJvmSignatures() {
return useJvmSignatures;
}

// Do not decrease this number.
private static final int STRING_BUILDER_INIT_CAPACITY = 512;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ private CompilationUnits() {}
private static final byte[] TAG_ENV = "ENV".getBytes(CHARSET);
private static final byte NL = 10;
private static final byte NULL = 0;

/**
* Computes the standard digest for the specified {@link CompilationUnit} in stringified
* hexidecimal form.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,16 @@ public class Metadata {
public static class Rule {
/** The starting byte offset in the source file. */
public int begin;

/** The ending byte offset in the source file. */
public int end;

/** The VName to emit if the rule matches. */
public VName vname;

/** The edge kind to emit if the rule matches. */
public EdgeKind edgeOut;

/**
* If false, draw the edge to the VName; if true, draw it from the VName. For example, if we
* emit an {@code Anchor defines/binding Node} edge, our range matches the anchor's, and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOEx
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
return delete(file, null);
}

/** Deletes {@code path}, and if a {@code path} is a directory, all contained files. */
public static void delete(Path path) throws IOException {
Files.walkFileTree(path, INSTANCE);
Expand Down
3 changes: 3 additions & 0 deletions kythe/java/com/google/devtools/kythe/util/Normalizer.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,13 @@ public final class Normalizer {

/** Total length of file text in bytes. */
private final int textLength;

/** Whether the file has a trailing newline. */
private final boolean trailingNewline;

/** List of ordered line lengths (index N -> line N+1's length). */
private final List<Integer> lineLength;

/** List of prefix lengths (index N -> length of file behind line N+1). */
private final List<Integer> prefixLength;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
*/
public class QualifiedNameExtractor {
private QualifiedNameExtractor() {}

/**
* Extracts a qualified name from the specified {@link MarkedSource} tree.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// Tests for a class in the default package. All name nodes should be prefixed with a ".", denoting
// the default package.

//- @DefaultPackage defines/binding Class
//- !{ Class childof AnyPackage
//- AnyPackage.node/kind package }
// - @DefaultPackage defines/binding Class
// - !{ Class childof AnyPackage
// - AnyPackage.node/kind package }
public class DefaultPackage {

//- @CONSTANT defines/binding _ConstantField
// - @CONSTANT defines/binding _ConstantField
public static final String CONSTANT = "constantly unused... :-(";

//- @main defines/binding _MainMethod
// - @main defines/binding _MainMethod
public static void main(String[] args) {}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package pkg;

//- @AbstractClass defines/binding ClassDef
//- ClassDef.tag/abstract _
// - @AbstractClass defines/binding ClassDef
// - ClassDef.tag/abstract _
abstract class AbstractClass {
//- @method defines/binding MethodDef
//- MethodDef.tag/abstract _
// - @method defines/binding MethodDef
// - MethodDef.tag/abstract _
public abstract void method();
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
package pkg;

//- @+4AnnotationComments defines/binding AnnotationComments
// - @+4AnnotationComments defines/binding AnnotationComments

// This isn't documentation.
@Deprecated // This does not document AnnotationComments
public class AnnotationComments {
//- !{ _ documents AnnotationComments }
// - !{ _ documents AnnotationComments }

//- @+3fooString defines/binding FooString
// - @+3fooString defines/binding FooString

@SuppressWarnings("unchecked") // This should not documents fooString.
public String fooString() { return ""; }
//- !{ _ documents FooString }
public String fooString() {
return "";
}
// - !{ _ documents FooString }
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,87 +2,87 @@

import com.google.auto.value.AutoValue;

//- File=vname("", Corpus, Root, Path, "").node/kind file
//- GeneratedFile=vname("", GenCorpus, GenRoot, GenPath, "").node/kind file
//- File generates GeneratedFile
// - File=vname("", Corpus, Root, Path, "").node/kind file
// - GeneratedFile=vname("", GenCorpus, GenRoot, GenPath, "").node/kind file
// - File generates GeneratedFile

//- GeneratedDef=vname(_, GenCorpus, GenRoot, GenPath, _).node/kind anchor
//- GeneratedDef defines/binding AutoStringPair
// - GeneratedDef=vname(_, GenCorpus, GenRoot, GenPath, _).node/kind anchor
// - GeneratedDef defines/binding AutoStringPair

@SuppressWarnings("unused")
//- @AutoValues=vname(_, Corpus, Root, Path, _).node/kind anchor
// - @AutoValues=vname(_, Corpus, Root, Path, _).node/kind anchor
public final class AutoValues {
private AutoValues() {}

@AutoValue
//- @StringPair defines/binding StringPair
// - @StringPair defines/binding StringPair
public abstract static class StringPair {
//- FirstProp.node/kind property
//- SecondProp.node/kind property
// - FirstProp.node/kind property
// - SecondProp.node/kind property

//- @first defines/binding FirstGetter
//- FirstGetter property/reads FirstProp
// - @first defines/binding FirstGetter
// - FirstGetter property/reads FirstProp
abstract String first();

//- FirstGetterImpl overrides FirstGetter
//- FirstGetterImpl property/reads FirstProp
//- FirstGetter generates FirstGetterImpl
// - FirstGetterImpl overrides FirstGetter
// - FirstGetterImpl property/reads FirstProp
// - FirstGetter generates FirstGetterImpl

//- @second defines/binding SecondGetter
//- SecondGetter property/reads SecondProp
// - @second defines/binding SecondGetter
// - SecondGetter property/reads SecondProp
abstract String second();

//- @AutoValue_AutoValues_StringPair ref AutoStringPair
//- AutoStringPair extends StringPair
//- StringPair generates AutoStringPair
// - @AutoValue_AutoValues_StringPair ref AutoStringPair
// - AutoStringPair extends StringPair
// - StringPair generates AutoStringPair
private static final AutoValue_AutoValues_StringPair IMPL = null;

@AutoValue.Builder
//- @Builder defines/binding StringPairBuilder
// - @Builder defines/binding StringPairBuilder
public abstract static class Builder {
//- @setFirst defines/binding FirstSetter
//- FirstSetter property/writes FirstProp
//- FirstSetter.semantic/generated set
// - @setFirst defines/binding FirstSetter
// - FirstSetter property/writes FirstProp
// - FirstSetter.semantic/generated set
public abstract Builder setFirst(String first);

//- FirstSetterImpl overrides FirstSetter
//- FirstSetterImpl property/writes FirstProp
//- FirstSetter generates FirstSetterImpl
// - FirstSetterImpl overrides FirstSetter
// - FirstSetterImpl property/writes FirstProp
// - FirstSetter generates FirstSetterImpl

//- @setSecond defines/binding SecondSetter
//- SecondSetter property/writes SecondProp
//- SecondSetter.semantic/generated set
// - @setSecond defines/binding SecondSetter
// - SecondSetter property/writes SecondProp
// - SecondSetter.semantic/generated set
public abstract Builder setSecond(String second);

public abstract StringPair build();

//- @Builder ref AutoStringPairBuilder
//- AutoStringPairBuilder extends StringPairBuilder
//- StringPairBuilder generates AutoStringPairBuilder
// - @Builder ref AutoStringPairBuilder
// - AutoStringPairBuilder extends StringPairBuilder
// - StringPairBuilder generates AutoStringPairBuilder
private static final AutoValue_AutoValues_StringPair.Builder IMPL = null;
}
}

@AutoValue
public abstract static class WithPrefixes {
//- @getString defines/binding GetString
//- GetString property/reads StringProp
// - @getString defines/binding GetString
// - GetString property/reads StringProp
public abstract String getString();

//- @isBool defines/binding GetBool
//- GetBool property/reads BoolProp
// - @isBool defines/binding GetBool
// - GetBool property/reads BoolProp
public abstract boolean isBool();

@AutoValue.Builder
public abstract static class Builder {
//- @setString defines/binding SetString
//- SetString property/writes StringProp
//- SetString.semantic/generated set
// - @setString defines/binding SetString
// - SetString property/writes StringProp
// - SetString.semantic/generated set
public abstract Builder setString(String s);

//- @setBool defines/binding SetBool
//- SetBool property/writes BoolProp
//- SetBool.semantic/generated set
// - @setBool defines/binding SetBool
// - SetBool property/writes BoolProp
// - SetBool.semantic/generated set
public abstract Builder setBool(boolean b);

public abstract WithPrefixes build();
Expand All @@ -91,24 +91,24 @@ public abstract static class Builder {

@AutoValue
public abstract static class AsInterface {
//- @getObject defines/binding GetObject
//- GetObject property/reads ObjectProp
// - @getObject defines/binding GetObject
// - GetObject property/reads ObjectProp
public abstract Object getObject();

//- GetObject generates GetObjectImpl
//- GetObjectImpl overrides GetObject
//- GetObjectImpl property/reads ObjectProp
// - GetObject generates GetObjectImpl
// - GetObjectImpl overrides GetObject
// - GetObjectImpl property/reads ObjectProp

@AutoValue.Builder
interface Builder {
//- @object defines/binding SetObject
//- SetObject property/writes ObjectProp
//- SetObject.semantic/generated set
// - @object defines/binding SetObject
// - SetObject property/writes ObjectProp
// - SetObject.semantic/generated set
public Builder object(Object o);

//- SetObject generates SetObjectImpl
//- SetObjectImpl overrides SetObject
//- SetObjectImpl property/writes ObjectProp
// - SetObject generates SetObjectImpl
// - SetObjectImpl overrides SetObject
// - SetObjectImpl property/writes ObjectProp

public AsInterface build();
}
Expand Down

0 comments on commit 9953914

Please sign in to comment.