码迷,mamicode.com
首页 > 其他好文 > 详细

interface类型

时间:2018-03-22 12:36:13      阅读:335      评论:0      收藏:0      [点我收藏+]

标签:ref   gen   less   str   ecs   contexts   aced   exce   parameter   

 

接口可使用的修饰符如下:

InterfaceModifier: one of
    Annotation public protected private
    abstract static strictfp 

 

接口中可声明的一些成员:

InterfaceMemberDeclaration:
ConstantDeclaration
AbstractMethodDeclaration
ClassDeclaration 
InterfaceDeclaration

  

 

The modifier static pertains only to member interfaces (§8.5.1§9.5), not to top level interfaces (§7.6).

The access modifiers protected and private pertain only to member interfaces within a directly enclosing class or enum declaration (§8.5.1).

9.1.1.2. strictfp Interfaces

The effect of the strictfp modifier is to make all float or double expressions within the interface declaration be explicitly FP-strict (§15.4).

This implies that all nested types declared in the interface are implicitly strictfp.

 

It is a compile-time error to refer to a type parameter of an interface I anywhere in the declaration of a field or type member of I.

 

9.1.3. Superinterfaces and Subinterfaces

If an extends clause is provided, then the interface being declared extends each of the other named interfaces and therefore inherits the member types, methods, and constants of each of the other named interfaces.

 

 

Given a (possibly generic) interface declaration for I<F1,...,Fn>(n ≥ 0), the direct superinterfaces of the interface typeI<F1,...,Fn> are the types given in the extends clause of the declaration of I if an extends clause is present.

Let I<F1,...,Fn> (n > 0), be a generic interface declaration. The direct superinterfaces of the parameterized interface type I<T1,...,Tn>, where Ti (1 ≤ i ≤ n) is a type, are all types J<U1θ,...,Uk θ>, where J<U1,...,Uk> is a direct superinterface ofI<F1,...,Fn>, and θ is the substitution [F1:=T1,...,Fn:=Tn].

 

 

9.2. Interface Members

The members of an interface are:

  • Those members declared in the interface.

  • Those members inherited from direct superinterfaces.

  • If an interface has no direct superinterfaces, then the interface implicitly declares a public abstract member method m with signature s, return type r, and throws clause t corresponding to each public instance method m with signature s, return type r, and throws clause t declared in Object, unless a method with the same signature, same return type, and a compatible throws clause is explicitly declared by the interface.

    It is a compile-time error if the interface explicitly declares such a method m in the case where m is declared to be final in Object.

    It follows that is a compile-time error if the interface declares a method with a signature that is override-equivalent (§8.4.2) to a public method of Object, but has a different return type or incompatible throwsclause.

The interface inherits, from the interfaces it extends, all members of those interfaces, except for (a) fields, classes, and interfaces that it hides and (b) methods that it overrides (§9.4.1).

Fields, methods, and member types of an interface type may have the same name, since they are used in different contexts and are disambiguated by different lookup procedures (§6.5). However, this is discouraged as a matter of style.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

interface类型

标签:ref   gen   less   str   ecs   contexts   aced   exce   parameter   

原文地址:https://www.cnblogs.com/extjs4/p/8622660.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!