Type signature ( MethodSymbol msym , List < JCTypeParameter > typarams , List < JCVariableDecl > params , JCTree res , JCVariableDecl recvparam , List < JCExpression > thrown , Env < AttrContext > env ) { // Enter and attribute type parameters. List < Type > tvars = enter . classEnter ( typarams , env ) ; attr . attribTypeVariables ( typarams , env ) ; // Enter and attribute value parameters. ListBuffer < Type > argbuf = new ListBuffer <> ( ) ; for ( List < JCVariableDecl > l = params ; l . nonEmpty ( ) ; l = l . tail ) { memberEnter ( l . head , env ) ; argbuf . append ( l . head . vartype . type ) ; } // Attribute result type, if one is given. Type restype = res == null ? syms . voidType : attr . attribType ( res , env ) ; // Attribute receiver type, if one is given. Type recvtype ; if ( recvparam != null ) { memberEnter ( recvparam , env ) ; recvtype = recvparam . vartype . type ; } else { recvtype = null ; } // Attribute thrown exceptions. ListBuffer < Type > thrownbuf = new ListBuffer <> ( ) ; for ( List < JCExpression > l = thrown ; l . nonEmpty ( ) ; l = l . tail ) { Type exc = attr . attribType ( l . head , env ) ; if ( ! exc . hasTag ( TYPEVAR ) ) { exc = chk . checkClassType ( l . head . pos ( ) , exc ) ; } else if ( exc . tsym . owner == msym ) { //mark inference variables in 'throws' clause exc . tsym . flags_field |= THROWS ; } thrownbuf . append ( exc ) ; } MethodType mtype = new MethodType ( argbuf . toList ( ) , restype , thrownbuf . toList ( ) , syms . methodClass ) ; mtype . recvtype = recvtype ; return tvars . isEmpty ( ) ? mtype : new ForAll ( tvars , mtype ) ; }
Construct method type from method signature .