Application yaml now verifies simple

property names
This commit is contained in:
Kris De Volder
2016-10-19 16:22:33 -07:00
parent 43f7659901
commit 59c78615ab
129 changed files with 4805 additions and 461 deletions

View File

@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>commons-java</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>

View File

@@ -0,0 +1,5 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.8

View File

@@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

View File

@@ -0,0 +1,22 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>commons-java</artifactId>
<name>commons-java</name>
<description>Common code related to 'accessing Java knowledge'</description>
<parent>
<groupId>org.springframework.ide.vscode</groupId>
<artifactId>commons-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.ide.vscode</groupId>
<artifactId>commons-util</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,195 @@
package org.springframework.ide.vscode.boot.properties.metadata.types;
public class Signature {
//These are the bits of JDTs 'Signature' class. Only we copied the method decls
// of stuff we actually use
//TODO: For performamce reason, JDT probably works with String or even naked char[] instead
// of wrapping these in a proper 'TypeSignature' or 'MethodSignature' object. But probably we should
// do the proper wrapping and abstract out a interface for these types. A 'client'
// using 'Java knowledge' should not have to directly be dealing with the JVM method and
// type signature strings.
/**
* Kind constant for a class type signature.
* @see #getTypeSignatureKind(String)
* @since 3.0
*/
public static final int CLASS_TYPE_SIGNATURE = 1;
/**
* Kind constant for an array type signature.
* @see #getTypeSignatureKind(String)
* @since 3.0
*/
public static final int ARRAY_TYPE_SIGNATURE = 4;
/**
* Character constant indicating the start of an unresolved, named type in a
* signature. Value is <code>'Q'</code>.
*/
public static final char C_UNRESOLVED = 'Q';
//TODO: unless we use JDT to work with suource-types we probably don't see these?
/**
* Returns the kind of type signature encoded by the given string.
*
* @param typeSignature the type signature string
* @return the kind of type signature; one of the kind constants:
* {@link #ARRAY_TYPE_SIGNATURE}, {@link #CLASS_TYPE_SIGNATURE},
* {@link #BASE_TYPE_SIGNATURE}, or {@link #TYPE_VARIABLE_SIGNATURE},
* or (since 3.1) {@link #WILDCARD_TYPE_SIGNATURE} or {@link #CAPTURE_TYPE_SIGNATURE}
* or (since 3.7) {@link #INTERSECTION_TYPE_SIGNATURE}
* @exception IllegalArgumentException if this is not a type signature
* @since 3.0
*/
public static int getTypeSignatureKind(String typeSignature) {
return getTypeSignatureKind(typeSignature.toCharArray());
}
/**
* Returns the kind of type signature encoded by the given string.
*
* @param typeSignature the type signature string
* @return the kind of type signature; one of the kind constants:
* {@link #ARRAY_TYPE_SIGNATURE}, {@link #CLASS_TYPE_SIGNATURE},
* {@link #BASE_TYPE_SIGNATURE}, or {@link #TYPE_VARIABLE_SIGNATURE},
* or (since 3.1) {@link #WILDCARD_TYPE_SIGNATURE} or {@link #CAPTURE_TYPE_SIGNATURE},
* or (since 3.7) {@link #INTERSECTION_TYPE_SIGNATURE}
* @exception IllegalArgumentException if this is not a type signature
* @since 3.0
*/
public static int getTypeSignatureKind(char[] typeSignature) {
throw new UnsupportedOperationException("Not yet implemented");
}
/**
* Extracts the type erasure signature from the given parameterized type signature.
* Returns the given type signature if it is not parameterized.
*
* @param parameterizedTypeSignature the parameterized type signature
* @return the signature of the type erasure
* @exception IllegalArgumentException if the signature is syntactically
* incorrect
*
* @since 3.1
*/
public static String getTypeErasure(String parameterizedTypeSignature) {
throw new UnsupportedOperationException("Not yet implemented");
}
/**
* Returns package fragment of a type signature. The package fragment separator must be '.'
* and the type fragment separator must be '$'.
* <p>
* For example:
* <pre>
* <code>
* getSignatureQualifier("Ljava.util.Map$Entry") -> "java.util"
* </code>
* </pre>
* </p>
*
* @param typeSignature the type signature
* @return the package fragment (separators are '.')
* @since 3.1
*/
public static String getSignatureQualifier(String typeSignature) {
throw new UnsupportedOperationException("Not yet implemented");
}
/**
* Returns type fragment of a type signature. The package fragment separator must be '.'
* and the type fragment separator must be '$'.
* <p>
* For example:
* <pre>
* <code>
* getSignatureSimpleName("Ljava.util.Map$Entry") -> "Map.Entry"
* </code>
* </pre>
* </p>
*
* @param typeSignature the type signature
* @return the type fragment (separators are '.')
* @since 3.1
*/
public static String getSignatureSimpleName(String typeSignature) {
throw new UnsupportedOperationException("Not yet implemented");
}
/**
* Extracts the type parameter signatures from the given method or type signature.
* The method or type signature is expected to be dot-based.
*
* @param methodOrTypeSignature the method or type signature
* @return the list of type parameter signatures
* @exception IllegalArgumentException if the signature is syntactically
* incorrect
*
* @since 3.1
*/
public static String[] getTypeParameters(String methodOrTypeSignature) throws IllegalArgumentException {
throw new UnsupportedOperationException("Not yet implemented");
}
/**
* Extracts the type argument signatures from the given type signature.
* Returns an empty array if the type signature is not a parameterized type signature.
*
* @param parameterizedTypeSignature the parameterized type signature
* @return the signatures of the type arguments
* @exception IllegalArgumentException if the signature is syntactically incorrect
*
* @since 3.1
*/
public static String[] getTypeArguments(String parameterizedTypeSignature) throws IllegalArgumentException {
throw new UnsupportedOperationException("Not yet implemented");
}
/**
* Returns the type signature without any array nesting.
* <p>
* For example:
* <pre>
* <code>
* getElementType("[[I") --> "I".
* </code>
* </pre>
* </p>
*
* @param typeSignature the type signature
* @return the type signature without arrays
* @exception IllegalArgumentException if the signature is not syntactically
* correct
*/
public static String getElementType(String typeSignature) throws IllegalArgumentException {
throw new UnsupportedOperationException("Not yet implemented");
}
/**
* Returns the array count (array nesting depth) of the given type signature.
*
* @param typeSignature the type signature
* @return the array nesting depth, or 0 if not an array
* @exception IllegalArgumentException if the signature is not syntactically
* correct
*/
public static int getArrayCount(String typeSignature) throws IllegalArgumentException {
throw new UnsupportedOperationException("Not yet implemented");
}
/**
* Returns the number of parameter types in the given method signature.
*
* @param methodSignature the method signature
* @return the number of parameters
* @exception IllegalArgumentException if the signature is not syntactically
* correct
*/
public static int getParameterCount(String methodSignature) throws IllegalArgumentException {
throw new UnsupportedOperationException("Not yet implemented");
}
}

View File

@@ -0,0 +1,161 @@
/*******************************************************************************
* Copyright (c) 2000, 2014 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
* Jesper S Moller - Contributions for
* Bug 405066 - [1.8][compiler][codegen] Implement code generation infrastructure for JSR335
* Bug 406982 - [1.8][compiler] Generation of MethodParameters Attribute in classfile
* Andy Clement (GoPivotal, Inc) aclement@gopivotal.com - Contributions for
* Bug 405104 - [1.8][compiler][codegen] Implement support for serializeable lambdas
*******************************************************************************/
package org.springframework.ide.vscode.java;
public interface ClassFileConstants {
int AccDefault = 0;
/*
* Modifiers
*/
int AccPublic = 0x0001;
int AccPrivate = 0x0002;
int AccProtected = 0x0004;
int AccStatic = 0x0008;
int AccFinal = 0x0010;
int AccSynchronized = 0x0020;
int AccVolatile = 0x0040;
int AccBridge = 0x0040;
int AccTransient = 0x0080;
int AccVarargs = 0x0080;
int AccNative = 0x0100;
int AccInterface = 0x0200;
int AccAbstract = 0x0400;
int AccStrictfp = 0x0800;
int AccSynthetic = 0x1000;
int AccAnnotation = 0x2000;
int AccEnum = 0x4000;
/**
* From classfile version 52 (compliance 1.8 up), meaning that a formal parameter is mandated
* by a language specification, so all compilers for the language must emit it.
*/
int AccMandated = 0x8000;
/**
* Other VM flags.
*/
int AccSuper = 0x0020;
// /**
// * Extra flags for types and members attributes (not from the JVMS, should have been defined in ExtraCompilerModifiers).
// */
// int AccAnnotationDefault = ASTNode.Bit18; // indicate presence of an attribute "DefaultValue" (annotation method)
// int AccDeprecated = ASTNode.Bit21; // indicate presence of an attribute "Deprecated"
int Utf8Tag = 1;
int IntegerTag = 3;
int FloatTag = 4;
int LongTag = 5;
int DoubleTag = 6;
int ClassTag = 7;
int StringTag = 8;
int FieldRefTag = 9;
int MethodRefTag = 10;
int InterfaceMethodRefTag = 11;
int NameAndTypeTag = 12;
int MethodHandleTag = 15;
int MethodTypeTag = 16;
int InvokeDynamicTag = 18;
int ConstantMethodRefFixedSize = 5;
int ConstantClassFixedSize = 3;
int ConstantDoubleFixedSize = 9;
int ConstantFieldRefFixedSize = 5;
int ConstantFloatFixedSize = 5;
int ConstantIntegerFixedSize = 5;
int ConstantInterfaceMethodRefFixedSize = 5;
int ConstantLongFixedSize = 9;
int ConstantStringFixedSize = 3;
int ConstantUtf8FixedSize = 3;
int ConstantNameAndTypeFixedSize = 5;
int ConstantMethodHandleFixedSize = 4;
int ConstantMethodTypeFixedSize = 3;
int ConstantInvokeDynamicFixedSize = 5;
// JVMS 4.4.8
int MethodHandleRefKindGetField = 1;
int MethodHandleRefKindGetStatic = 2;
int MethodHandleRefKindPutField = 3;
int MethodHandleRefKindPutStatic = 4;
int MethodHandleRefKindInvokeVirtual = 5;
int MethodHandleRefKindInvokeStatic = 6;
int MethodHandleRefKindInvokeSpecial = 7;
int MethodHandleRefKindNewInvokeSpecial = 8;
int MethodHandleRefKindInvokeInterface = 9;
int MAJOR_VERSION_1_1 = 45;
int MAJOR_VERSION_1_2 = 46;
int MAJOR_VERSION_1_3 = 47;
int MAJOR_VERSION_1_4 = 48;
int MAJOR_VERSION_1_5 = 49;
int MAJOR_VERSION_1_6 = 50;
int MAJOR_VERSION_1_7 = 51;
int MAJOR_VERSION_1_8 = 52;
int MAJOR_VERSION_1_9 = 53; // This might change
int MINOR_VERSION_0 = 0;
int MINOR_VERSION_1 = 1;
int MINOR_VERSION_2 = 2;
int MINOR_VERSION_3 = 3;
int MINOR_VERSION_4 = 4;
// JDK 1.1 -> 1.9, comparable value allowing to check both major/minor version at once 1.4.1 > 1.4.0
// 16 unsigned bits for major, then 16 bits for minor
long JDK1_1 = ((long)ClassFileConstants.MAJOR_VERSION_1_1 << 16) + ClassFileConstants.MINOR_VERSION_3; // 1.1. is 45.3
long JDK1_2 = ((long)ClassFileConstants.MAJOR_VERSION_1_2 << 16) + ClassFileConstants.MINOR_VERSION_0;
long JDK1_3 = ((long)ClassFileConstants.MAJOR_VERSION_1_3 << 16) + ClassFileConstants.MINOR_VERSION_0;
long JDK1_4 = ((long)ClassFileConstants.MAJOR_VERSION_1_4 << 16) + ClassFileConstants.MINOR_VERSION_0;
long JDK1_5 = ((long)ClassFileConstants.MAJOR_VERSION_1_5 << 16) + ClassFileConstants.MINOR_VERSION_0;
long JDK1_6 = ((long)ClassFileConstants.MAJOR_VERSION_1_6 << 16) + ClassFileConstants.MINOR_VERSION_0;
long JDK1_7 = ((long)ClassFileConstants.MAJOR_VERSION_1_7 << 16) + ClassFileConstants.MINOR_VERSION_0;
long JDK1_8 = ((long)ClassFileConstants.MAJOR_VERSION_1_8 << 16) + ClassFileConstants.MINOR_VERSION_0;
long JDK1_9 = ((long)ClassFileConstants.MAJOR_VERSION_1_9 << 16) + ClassFileConstants.MINOR_VERSION_0;
/*
* cldc1.1 is 45.3, but we modify it to be different from JDK1_1.
* In the code gen, we will generate the same target value as JDK1_1
*/
long CLDC_1_1 = ((long)ClassFileConstants.MAJOR_VERSION_1_1 << 16) + ClassFileConstants.MINOR_VERSION_4;
// jdk level used to denote future releases: optional behavior is not enabled for now, but may become so. In order to enable these,
// search for references to this constant, and change it to one of the official JDT constants above.
long JDK_DEFERRED = Long.MAX_VALUE;
int INT_ARRAY = 10;
int BYTE_ARRAY = 8;
int BOOLEAN_ARRAY = 4;
int SHORT_ARRAY = 9;
int CHAR_ARRAY = 5;
int LONG_ARRAY = 11;
int FLOAT_ARRAY = 6;
int DOUBLE_ARRAY = 7;
// Debug attributes
int ATTR_SOURCE = 0x1; // SourceFileAttribute
int ATTR_LINES = 0x2; // LineNumberAttribute
int ATTR_VARS = 0x4; // LocalVariableTableAttribute
int ATTR_STACK_MAP_TABLE = 0x8; // Stack map table attribute
int ATTR_STACK_MAP = 0x10; // Stack map attribute: cldc
int ATTR_TYPE_ANNOTATION = 0x20; // type annotation attribute (jsr 308)
int ATTR_METHOD_PARAMETERS = 0x40; // method parameters attribute (jep 118)
// See java.lang.invoke.LambdaMetafactory constants - option bitflags when calling altMetaFactory()
int FLAG_SERIALIZABLE = 0x01;
int FLAG_MARKERS = 0x02;
int FLAG_BRIDGES = 0x04;
}

View File

@@ -0,0 +1,473 @@
/*******************************************************************************
* Copyright (c) 2000, 2013 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
* IBM Corporation - added constant AccDefault
* IBM Corporation - added constants AccBridge and AccVarargs for J2SE 1.5
*******************************************************************************/
package org.springframework.ide.vscode.java;
/**
* Utility class for decoding modifier flags in Java elements.
* <p>
* This class provides static methods only.
* </p>
* <p>
* Note that the numeric values of these flags match the ones for class files
* as described in the Java Virtual Machine Specification (except for
* {@link #AccDeprecated}, {@link #AccAnnotationDefault}, and {@link #AccDefaultMethod}).
* </p>
* <p>
* The AST class <code>Modifier</code> provides
* similar functionality as this class, only in the
* <code>org.eclipse.jdt.core.dom</code> package.
* </p>
*
* @see IMember#getFlags()
* @noinstantiate This class is not intended to be instantiated by clients.
*/
public final class Flags {
/**
* Constant representing the absence of any flag.
* @since 3.0
*/
public static final int AccDefault = ClassFileConstants.AccDefault;
/**
* Public access flag. See The Java Virtual Machine Specification for more details.
* @since 2.0
*/
public static final int AccPublic = ClassFileConstants.AccPublic;
/**
* Private access flag. See The Java Virtual Machine Specification for more details.
* @since 2.0
*/
public static final int AccPrivate = ClassFileConstants.AccPrivate;
/**
* Protected access flag. See The Java Virtual Machine Specification for more details.
* @since 2.0
*/
public static final int AccProtected = ClassFileConstants.AccProtected;
/**
* Static access flag. See The Java Virtual Machine Specification for more details.
* @since 2.0
*/
public static final int AccStatic = ClassFileConstants.AccStatic;
/**
* Final access flag. See The Java Virtual Machine Specification for more details.
* @since 2.0
*/
public static final int AccFinal = ClassFileConstants.AccFinal;
/**
* Synchronized access flag. See The Java Virtual Machine Specification for more details.
* @since 2.0
*/
public static final int AccSynchronized = ClassFileConstants.AccSynchronized;
/**
* Volatile property flag. See The Java Virtual Machine Specification for more details.
* @since 2.0
*/
public static final int AccVolatile = ClassFileConstants.AccVolatile;
/**
* Transient property flag. See The Java Virtual Machine Specification for more details.
* @since 2.0
*/
public static final int AccTransient = ClassFileConstants.AccTransient;
/**
* Native property flag. See The Java Virtual Machine Specification for more details.
* @since 2.0
*/
public static final int AccNative = ClassFileConstants.AccNative;
/**
* Interface property flag. See The Java Virtual Machine Specification for more details.
* @since 2.0
*/
public static final int AccInterface = ClassFileConstants.AccInterface;
/**
* Abstract property flag. See The Java Virtual Machine Specification for more details.
* @since 2.0
*/
public static final int AccAbstract = ClassFileConstants.AccAbstract;
/**
* Strictfp property flag. See The Java Virtual Machine Specification for more details.
* @since 2.0
*/
public static final int AccStrictfp = ClassFileConstants.AccStrictfp;
/**
* Super property flag. See The Java Virtual Machine Specification for more details.
* @since 2.0
*/
public static final int AccSuper = ClassFileConstants.AccSuper;
/**
* Synthetic property flag. See The Java Virtual Machine Specification for more details.
* @since 2.0
*/
public static final int AccSynthetic = ClassFileConstants.AccSynthetic;
// /**
// * Deprecated property flag.
// * <p>
// * Note that this flag's value is internal and is not defined in the
// * Virtual Machine specification.
// * </p>
// * @since 2.0
// */
// public static final int AccDeprecated = ClassFileConstants.AccDeprecated;
/**
* Bridge method property flag (added in J2SE 1.5). Used to flag a compiler-generated
* bridge methods.
* See The Java Virtual Machine Specification for more details.
* @since 3.0
*/
public static final int AccBridge = ClassFileConstants.AccBridge;
/**
* Varargs method property flag (added in J2SE 1.5).
* Used to flag variable arity method declarations.
* See The Java Virtual Machine Specification for more details.
* @since 3.0
*/
public static final int AccVarargs = ClassFileConstants.AccVarargs;
/**
* Enum property flag (added in J2SE 1.5).
* See The Java Virtual Machine Specification for more details.
* @since 3.0
*/
public static final int AccEnum = ClassFileConstants.AccEnum;
/**
* Annotation property flag (added in J2SE 1.5).
* See The Java Virtual Machine Specification for more details.
* @since 3.0
*/
public static final int AccAnnotation = ClassFileConstants.AccAnnotation;
// /**
// * Default method property flag.
// * <p>
// * Note that this flag's value is internal and is not defined in the
// * Virtual Machine specification.
// * </p>
// * @since 3.10
// */
// public static final int AccDefaultMethod = ExtraCompilerModifiers.AccDefaultMethod;
//
// /**
// * Annotation method default property flag.
// * Used to flag annotation type methods that declare a default value.
// * <p>
// * Note that this flag's value is internal and is not defined in the
// * Virtual Machine specification.
// * </p>
// * @since 3.10
// */
// public static final int AccAnnotationDefault = ClassFileConstants.AccAnnotationDefault;
/**
* Not instantiable.
*/
private Flags() {
// Not instantiable
}
/**
* Returns whether the given integer includes the <code>abstract</code> modifier.
*
* @param flags the flags
* @return <code>true</code> if the <code>abstract</code> modifier is included
*/
public static boolean isAbstract(int flags) {
return (flags & AccAbstract) != 0;
}
// /**
// * Returns whether the given integer includes the indication that the
// * element is deprecated (<code>@deprecated</code> tag in Javadoc comment).
// *
// * @param flags the flags
// * @return <code>true</code> if the element is marked as deprecated
// */
// public static boolean isDeprecated(int flags) {
// return (flags & AccDeprecated) != 0;
// }
/**
* Returns whether the given integer includes the <code>final</code> modifier.
*
* @param flags the flags
* @return <code>true</code> if the <code>final</code> modifier is included
*/
public static boolean isFinal(int flags) {
return (flags & AccFinal) != 0;
}
/**
* Returns whether the given integer includes the <code>interface</code> modifier.
*
* @param flags the flags
* @return <code>true</code> if the <code>interface</code> modifier is included
* @since 2.0
*/
public static boolean isInterface(int flags) {
return (flags & AccInterface) != 0;
}
/**
* Returns whether the given integer includes the <code>native</code> modifier.
*
* @param flags the flags
* @return <code>true</code> if the <code>native</code> modifier is included
*/
public static boolean isNative(int flags) {
return (flags & AccNative) != 0;
}
/**
* Returns whether the given integer does not include one of the
* <code>public</code>, <code>private</code>, or <code>protected</code> flags.
*
* @param flags the flags
* @return <code>true</code> if no visibility flag is set
* @since 3.2
*/
public static boolean isPackageDefault(int flags) {
return (flags & (AccPublic | AccPrivate | AccProtected)) == 0;
}
/**
* Returns whether the given integer includes the <code>private</code> modifier.
*
* @param flags the flags
* @return <code>true</code> if the <code>private</code> modifier is included
*/
public static boolean isPrivate(int flags) {
return (flags & AccPrivate) != 0;
}
/**
* Returns whether the given integer includes the <code>protected</code> modifier.
*
* @param flags the flags
* @return <code>true</code> if the <code>protected</code> modifier is included
*/
public static boolean isProtected(int flags) {
return (flags & AccProtected) != 0;
}
/**
* Returns whether the given integer includes the <code>public</code> modifier.
*
* @param flags the flags
* @return <code>true</code> if the <code>public</code> modifier is included
*/
public static boolean isPublic(int flags) {
return (flags & AccPublic) != 0;
}
/**
* Returns whether the given integer includes the <code>static</code> modifier.
*
* @param flags the flags
* @return <code>true</code> if the <code>static</code> modifier is included
*/
public static boolean isStatic(int flags) {
return (flags & AccStatic) != 0;
}
/**
* Returns whether the given integer includes the <code>super</code> modifier.
*
* @param flags the flags
* @return <code>true</code> if the <code>super</code> modifier is included
* @since 3.2
*/
public static boolean isSuper(int flags) {
return (flags & AccSuper) != 0;
}
/**
* Returns whether the given integer includes the <code>strictfp</code> modifier.
*
* @param flags the flags
* @return <code>true</code> if the <code>strictfp</code> modifier is included
*/
public static boolean isStrictfp(int flags) {
return (flags & AccStrictfp) != 0;
}
/**
* Returns whether the given integer includes the <code>synchronized</code> modifier.
*
* @param flags the flags
* @return <code>true</code> if the <code>synchronized</code> modifier is included
*/
public static boolean isSynchronized(int flags) {
return (flags & AccSynchronized) != 0;
}
/**
* Returns whether the given integer includes the indication that the
* element is synthetic.
*
* @param flags the flags
* @return <code>true</code> if the element is marked synthetic
*/
public static boolean isSynthetic(int flags) {
return (flags & AccSynthetic) != 0;
}
/**
* Returns whether the given integer includes the <code>transient</code> modifier.
*
* @param flags the flags
* @return <code>true</code> if the <code>transient</code> modifier is included
*/
public static boolean isTransient(int flags) {
return (flags & AccTransient) != 0;
}
/**
* Returns whether the given integer includes the <code>volatile</code> modifier.
*
* @param flags the flags
* @return <code>true</code> if the <code>volatile</code> modifier is included
*/
public static boolean isVolatile(int flags) {
return (flags & AccVolatile) != 0;
}
/**
* Returns whether the given integer has the <code>AccBridge</code>
* bit set.
*
* @param flags the flags
* @return <code>true</code> if the <code>AccBridge</code> flag is included
* @see #AccBridge
* @since 3.0
*/
public static boolean isBridge(int flags) {
return (flags & AccBridge) != 0;
}
/**
* Returns whether the given integer has the <code>AccVarargs</code>
* bit set.
*
* @param flags the flags
* @return <code>true</code> if the <code>AccVarargs</code> flag is included
* @see #AccVarargs
* @since 3.0
*/
public static boolean isVarargs(int flags) {
return (flags & AccVarargs) != 0;
}
/**
* Returns whether the given integer has the <code>AccEnum</code>
* bit set.
*
* @param flags the flags
* @return <code>true</code> if the <code>AccEnum</code> flag is included
* @see #AccEnum
* @since 3.0
*/
public static boolean isEnum(int flags) {
return (flags & AccEnum) != 0;
}
/**
* Returns whether the given integer has the <code>AccAnnotation</code>
* bit set.
*
* @param flags the flags
* @return <code>true</code> if the <code>AccAnnotation</code> flag is included
* @see #AccAnnotation
* @since 3.0
*/
public static boolean isAnnotation(int flags) {
return (flags & AccAnnotation) != 0;
}
// /**
// * Returns whether the given integer has the <code>AccDefaultMethod</code>
// * bit set. Note that this flag represents the usage of the 'default' keyword
// * on a method and should not be confused with the 'package' access visibility (which used to be called 'default access').
// *
// * @return <code>true</code> if the <code>AccDefaultMethod</code> flag is included
// * @see #AccDefaultMethod
// * @since 3.10
// */
// public static boolean isDefaultMethod(int flags) {
// return (flags & AccDefaultMethod) != 0;
// }
// /**
// * Returns whether the given integer has the <code>AccAnnnotationDefault</code>
// * bit set.
// *
// * @return <code>true</code> if the <code>AccAnnotationDefault</code> flag is included
// * @see #AccAnnotationDefault
// * @since 3.10
// */
// public static boolean isAnnnotationDefault(int flags) {
// return (flags & AccAnnotationDefault) != 0;
// }
/**
* Returns a standard string describing the given modifier flags.
* Only modifier flags are included in the output; deprecated,
* synthetic, bridge, etc. flags are ignored.
* <p>
* The flags are output in the following order:
* <pre> public protected private
* abstract default static final synchronized native strictfp transient volatile</pre>
* <p>
* This order is consistent with the recommendations in JLS8 ("*Modifier:" rules in chapters 8 and 9).
* </p>
* <p>
* Note that the flags of a method can include the AccVarargs flag that has no standard description. Since the AccVarargs flag has the same value as
* the AccTransient flag (valid for fields only), attempting to get the description of method modifiers with the AccVarargs flag set would result in an
* unexpected description. Clients should ensure that the AccVarargs is not included in the flags of a method as follows:
* <pre>
* IMethod method = ...
* int flags = method.getFlags() & ~Flags.AccVarargs;
* return Flags.toString(flags);
* </pre>
* </p>
* <p>
* Examples results:
* <pre>
* <code>"public static final"</code>
* <code>"private native"</code>
* </pre>
* </p>
*
* @param flags the flags
* @return the standard string representation of the given flags
*/
public static String toString(int flags) {
StringBuffer sb = new StringBuffer();
if (isPublic(flags))
sb.append("public "); //$NON-NLS-1$
if (isProtected(flags))
sb.append("protected "); //$NON-NLS-1$
if (isPrivate(flags))
sb.append("private "); //$NON-NLS-1$
if (isAbstract(flags))
sb.append("abstract "); //$NON-NLS-1$
// if (isDefaultMethod(flags))
// sb.append("default "); //$NON-NLS-1$
if (isStatic(flags))
sb.append("static "); //$NON-NLS-1$
if (isFinal(flags))
sb.append("final "); //$NON-NLS-1$
if (isSynchronized(flags))
sb.append("synchronized "); //$NON-NLS-1$
if (isNative(flags))
sb.append("native "); //$NON-NLS-1$
if (isStrictfp(flags))
sb.append("strictfp "); //$NON-NLS-1$
if (isTransient(flags))
sb.append("transient "); //$NON-NLS-1$
if (isVolatile(flags))
sb.append("volatile "); //$NON-NLS-1$
int len = sb.length();
if (len == 0)
return ""; //$NON-NLS-1$
sb.setLength(len - 1);
return sb.toString();
}
}

View File

@@ -0,0 +1,7 @@
package org.springframework.ide.vscode.java;
public interface IAnnotatable extends IJavaElement {
IAnnotation[] getAnnotations();
}

View File

@@ -0,0 +1,15 @@
package org.springframework.ide.vscode.java;
public interface IAnnotation extends IJavaElement {
/**
* Returns the member-value pairs of this annotation. Returns an empty
* array if this annotation is a marker annotation. Returns a size-1 array if this
* annotation is a single member annotation. In this case, the member
* name is always <code>"value"</code>.
*
* @return the member-value pairs of this annotation
*/
IMemberValuePair[] getMemberValuePairs();
}

View File

@@ -0,0 +1,5 @@
package org.springframework.ide.vscode.java;
public interface IField extends IMember {
boolean isEnumConstant();
}

View File

@@ -0,0 +1,9 @@
package org.springframework.ide.vscode.java;
import org.springframework.ide.vscode.util.HtmlSnippet;
public interface IJavaElement {
String getElementName();
HtmlSnippet getJavaDoc();
boolean exists();
}

View File

@@ -0,0 +1,8 @@
package org.springframework.ide.vscode.java;
import java.nio.file.Path;
public interface IJavaProject extends IJavaElement {
IType findType(String fqName);
Path getPath();
}

View File

@@ -0,0 +1,35 @@
package org.springframework.ide.vscode.java;
public interface IMember extends IJavaElement, IAnnotatable {
/**
* Returns the modifier flags for this member. The flags can be examined using class
* <code>Flags</code>.
* <p>
* For {@linkplain #isBinary() binary} members, flags from the class file
* as well as derived flags {@link Flags#AccAnnotationDefault} and {@link Flags#AccDefaultMethod} are included.
* </p>
* <p>
* For source members, only flags as indicated in the source are returned. Thus if an interface
* defines a method <code>void myMethod();</code>, the flags don't include the
* 'public' flag. Source flags include {@link Flags#AccAnnotationDefault} as well.
* </p>
*
* @exception JavaModelException if this element does not exist or if an
* exception occurs while accessing its corresponding resource.
* @return the modifier flags for this member
* @see Flags
*/
int getFlags();
/**
* Returns the type in which this member is declared, or <code>null</code>
* if this member is not declared in a type (for example, a top-level type).
* This is a handle-only method.
*
* @return the type in which this member is declared, or <code>null</code>
* if this member is not declared in a type (for example, a top-level type)
*/
IType getDeclaringType();
}

View File

@@ -0,0 +1,28 @@
package org.springframework.ide.vscode.java;
public interface IMemberValuePair {
/**
* Returns the member's name of this member-value pair.
*
* @return the member's name of this member-value pair.
*/
String getMemberName();
/**
* Returns the value of this member-value pair. The type of this value
* is function of this member-value pair's {@link #getValueKind() value kind}. It is an
* instance of {@link Object}[] if the value is an array.
* <p>
* If the value kind is {@link #K_UNKNOWN} and the value is not an array, then the
* value is <code>null</code>.
* If the value kind is {@link #K_UNKNOWN} and the value is an array, then the
* value is an array containing {@link Object}s and/or <code>null</code>s for
* unknown elements.
* See {@link #K_UNKNOWN} for more details.
* </p>
* @return the value of this member-value pair.
*/
Object getValue();
}

View File

@@ -0,0 +1,49 @@
package org.springframework.ide.vscode.java;
import org.springframework.ide.vscode.boot.properties.metadata.types.Signature;
public interface IMethod extends IMember {
/**
* Returns the type signature of the return value of this method.
* For constructors, this returns the signature for void.
* <p>
* For example, a source method declared as <code>public String getName()</code>
* would return <code>"QString;"</code>.
* </p>
* <p>
* The type signature may be either unresolved (for source types)
* or resolved (for binary types), and either basic (for basic types)
* or rich (for parameterized types). See {@link Signature} for details.
* </p>
*
* @exception JavaModelException if this element does not exist or if an
* exception occurs while accessing its corresponding resource.
* @return the type signature of the return value of this method, void for constructors
* @see Signature
*/
String getReturnType();
/**
* Returns the signature of this method. This includes the signatures for the
* parameter types and return type, but does not include the method name,
* exception types, or type parameters.
* <p>
* For example, a source method declared as <code>public void foo(String text, int length)</code>
* would return <code>"(QString;I)V"</code>.
* </p>
* <p>
* The type signatures embedded in the method signature may be either unresolved
* (for source types) or resolved (for binary types), and either basic (for
* basic types) or rich (for parameterized types). See {@link Signature} for
* details.
* </p>
*
* @return the signature of this method
* @exception JavaModelException if this element does not exist or if an
* exception occurs while accessing its corresponding resource.
* @see Signature
*/
String getSignature();
}

View File

@@ -0,0 +1,120 @@
/*******************************************************************************
* Copyright (c) 2000, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
* IBM Corporation - added J2SE 1.5 support
* Stephan Herrmann - Contribution for
* Bug 463533 - Signature.getSignatureSimpleName() returns different results for resolved and unresolved extends
*******************************************************************************/
package org.springframework.ide.vscode.java;
/**
* Replaces eclipse JDT IType.
*/
public interface IType extends IMember {
boolean isClass();
boolean isEnum();
boolean isInterface();
/**
* Returns the fully qualified name of this type,
* including qualification for any containing types and packages.
* This is the name of the package, followed by <code>'.'</code>,
* followed by the type-qualified name.
* <p>
* <b>Note</b>: The enclosing type separator used in the type-qualified
* name is <code>'$'</code>, not <code>'.'</code>.
* </p>
* This method is fully equivalent to <code>getFullyQualifiedName('$')</code>.
* This is a handle-only method.
*
* @see IType#getTypeQualifiedName()
* @see IType#getFullyQualifiedName(char)
* @return the fully qualified name of this type
*/
String getFullyQualifiedName();
/**
* Returns the field with the specified name
* in this type (for example, <code>"bar"</code>).
* This is a handle-only method. The field may or may not exist.
*
* @param name the given name
* @return the field with the specified name in this type
*/
IField getField(String name);
/**
* Returns the fields declared by this type in the order in which they appear
* in the source or class file. For binary types, this includes synthetic fields.
*
* @return the fields declared by this type
*/
IField[] getFields();
/**
* Returns the method with the specified name and parameter types
* in this type (for example, <code>"foo", {"I", "QString;"}</code>).
* To get the handle for a constructor, the name specified must be the
* simple name of the enclosing type.
* This is a handle-only method. The method may or may not be present.
* <p>
* The type signatures may be either unresolved (for source types)
* or resolved (for binary types), and either basic (for basic types)
* or rich (for parameterized types). See {@link Signature} for details.
* Note that the parameter type signatures for binary methods are expected
* to be dot-based.
* </p>
*
* @param name the given name
* @param parameterTypeSignatures the given parameter types
* @return the method with the specified name and parameter types in this type
*/
IMethod getMethod(String name, String[] parameterTypeSignatures);
/**
* Returns the methods and constructors declared by this type.
* For binary types, this may include the special <code>&lt;clinit&gt;</code> method
* and synthetic methods.
* <p>
* The results are listed in the order in which they appear in the source or class file.
* </p>
*
* @return the methods and constructors declared by this type
*/
IMethod[] getMethods();
/**
* Resolves the given type name within the context of this type (depending on the type hierarchy
* and its imports).
* <p>
* Multiple answers might be found in case there are ambiguous matches.
* </p>
* <p>
* Each matching type name is decomposed as an array of two strings, the first denoting the package
* name (dot-separated) and the second being the type name. The package name is empty if it is the
* default package. The type name is the type qualified name using a '.' enclosing type separator.
* </p>
* <p>
* Returns <code>null</code> if unable to find any matching type.
* </p>
*<p>
* For example, resolution of <code>"Object"</code> would typically return
* <code>{{"java.lang", "Object"}}</code>. Another resolution that returns
* <code>{{"", "X.Inner"}}</code> represents the inner type Inner defined in type X in the
* default package.
* </p>
*
* @param typeName the given type name
* @return the resolved type names or <code>null</code> if unable to find any matching type
* @see #getTypeQualifiedName(char)
*/
String[][] resolveType(String typeName);
}