< prev index next >

src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/ResolvedJavaMethod.java

Print this page




  76      * {@inheritDoc}
  77      * <p>
  78      * Only the {@linkplain Modifier#methodModifiers() method flags} specified in the JVM
  79      * specification will be included in the returned mask.
  80      */
  81     int getModifiers();
  82 
  83     default boolean isFinal() {
  84         return ModifiersProvider.super.isFinalFlagSet();
  85     }
  86 
  87     /**
  88      * Determines if this method is a synthetic method as defined by the Java Language
  89      * Specification.
  90      */
  91     default boolean isSynthetic() {
  92         return (SYNTHETIC & getModifiers()) == SYNTHETIC;
  93     }
  94 
  95     /**
  96      * Checks that the method is a <a
  97      * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.6">varargs</a>
  98      * method.
  99      *
 100      * @return whether the method is a varargs method
 101      */
 102     default boolean isVarArgs() {
 103         return (VARARGS & getModifiers()) == VARARGS;
 104     }
 105 
 106     /**
 107      * Checks that the method is a <a
 108      * href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.6">bridge</a>
 109      * method.
 110      *
 111      * @return whether the method is a bridge method
 112      */
 113     default boolean isBridge() {
 114         return (BRIDGE & getModifiers()) == BRIDGE;
 115     }
 116 
 117     /**
 118      * Returns {@code true} if this method is a default method; returns {@code false} otherwise.
 119      *
 120      * A default method is a public non-abstract instance method, that is, a non-static method with
 121      * a body, declared in an interface type.
 122      *
 123      * @return true if and only if this method is a default method as defined by the Java Language
 124      *         Specification.
 125      */
 126     boolean isDefault();
 127 
 128     /**


 330 
 331     /**
 332      * Checks whether the method has a receiver parameter - i.e., whether it is not static.
 333      *
 334      * @return whether the method has a receiver parameter
 335      */
 336     default boolean hasReceiver() {
 337         return !isStatic();
 338     }
 339 
 340     /**
 341      * Determines if this method is {@link java.lang.Object#Object()}.
 342      */
 343     default boolean isJavaLangObjectInit() {
 344         return getDeclaringClass().isJavaLangObject() && getName().equals("<init>");
 345     }
 346 
 347     SpeculationLog getSpeculationLog();
 348 
 349     /**
 350      * Determines if the method identified by its holder and name is a <a
 351      * href="https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-2.html#jvms-2.9">signature
 352      * polymorphic</a> method.
 353      */
 354     static boolean isSignaturePolymorphic(JavaType holder, String name, MetaAccessProvider metaAccess) {
 355         if (!holder.getName().equals("Ljava/lang/invoke/MethodHandle;")) {
 356             return false;
 357         }
 358         ResolvedJavaType methodHandleType = metaAccess.lookupJavaType(MethodHandle.class);
 359         Signature signature = metaAccess.parseMethodDescriptor("([Ljava/lang/Object;)Ljava/lang/Object;");
 360         ResolvedJavaMethod method = methodHandleType.findMethod(name, signature);
 361         if (method == null) {
 362             return false;
 363         }
 364         return method.isNative() && method.isVarArgs();
 365     }
 366 }


  76      * {@inheritDoc}
  77      * <p>
  78      * Only the {@linkplain Modifier#methodModifiers() method flags} specified in the JVM
  79      * specification will be included in the returned mask.
  80      */
  81     int getModifiers();
  82 
  83     default boolean isFinal() {
  84         return ModifiersProvider.super.isFinalFlagSet();
  85     }
  86 
  87     /**
  88      * Determines if this method is a synthetic method as defined by the Java Language
  89      * Specification.
  90      */
  91     default boolean isSynthetic() {
  92         return (SYNTHETIC & getModifiers()) == SYNTHETIC;
  93     }
  94 
  95     /**
  96      * Checks that the method is a
  97      * <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.6">varargs</a>
  98      * method.
  99      *
 100      * @return whether the method is a varargs method
 101      */
 102     default boolean isVarArgs() {
 103         return (VARARGS & getModifiers()) == VARARGS;
 104     }
 105 
 106     /**
 107      * Checks that the method is a
 108      * <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.6">bridge</a>
 109      * method.
 110      *
 111      * @return whether the method is a bridge method
 112      */
 113     default boolean isBridge() {
 114         return (BRIDGE & getModifiers()) == BRIDGE;
 115     }
 116 
 117     /**
 118      * Returns {@code true} if this method is a default method; returns {@code false} otherwise.
 119      *
 120      * A default method is a public non-abstract instance method, that is, a non-static method with
 121      * a body, declared in an interface type.
 122      *
 123      * @return true if and only if this method is a default method as defined by the Java Language
 124      *         Specification.
 125      */
 126     boolean isDefault();
 127 
 128     /**


 330 
 331     /**
 332      * Checks whether the method has a receiver parameter - i.e., whether it is not static.
 333      *
 334      * @return whether the method has a receiver parameter
 335      */
 336     default boolean hasReceiver() {
 337         return !isStatic();
 338     }
 339 
 340     /**
 341      * Determines if this method is {@link java.lang.Object#Object()}.
 342      */
 343     default boolean isJavaLangObjectInit() {
 344         return getDeclaringClass().isJavaLangObject() && getName().equals("<init>");
 345     }
 346 
 347     SpeculationLog getSpeculationLog();
 348 
 349     /**
 350      * Determines if the method identified by its holder and name is a
 351      * <a href="https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-2.html#jvms-2.9">signature
 352      * polymorphic</a> method.
 353      */
 354     static boolean isSignaturePolymorphic(JavaType holder, String name, MetaAccessProvider metaAccess) {
 355         if (!holder.getName().equals("Ljava/lang/invoke/MethodHandle;")) {
 356             return false;
 357         }
 358         ResolvedJavaType methodHandleType = metaAccess.lookupJavaType(MethodHandle.class);
 359         Signature signature = metaAccess.parseMethodDescriptor("([Ljava/lang/Object;)Ljava/lang/Object;");
 360         ResolvedJavaMethod method = methodHandleType.findMethod(name, signature);
 361         if (method == null) {
 362             return false;
 363         }
 364         return method.isNative() && method.isVarArgs();
 365     }
 366 }
< prev index next >