Discussion:
Deprecated attribute in module-info.class?
Stephan Herrmann
2018-03-29 14:36:24 UTC
Permalink
I'm looking at jdk.xml.bind/module-info.class from JDK 9.0.4.

I do find a RuntimeVisibleAnnotation attribute representing
@java.lang.Deprecated(since="9", forRemoval=true)
but I don't find a Deprecated attribute.

Is this intended? JVMS 4.7.15 neither includes nor excludes
modules, but not generating the Deprecated attribute looks
like an omission to me.

best,
Stephan

PS: Tested also with JDK 10+46
Alan Bateman
2018-03-29 16:02:51 UTC
Permalink
Post by Stephan Herrmann
I'm looking at jdk.xml.bind/module-info.class from JDK 9.0.4.
I do find a RuntimeVisibleAnnotation attribute representing
but I don't find a Deprecated attribute.
Is this intended? JVMS 4.7.15 neither includes nor excludes
modules, but not generating the Deprecated attribute looks
like an omission to me.
Are you using `javap` to look at the class or something else?

I ask because `javap` tool was updated in JDK 10 to render annotations
in a more friendly way. When I use the JDK 10 `javap` to look at the
jdk.xml.bind's module-info.class from JDK 9 I see:

RuntimeVisibleAnnotations:
  0: #5(#6=s#7,#8=Z#9)
    java.lang.Deprecated(
      since="9"
      forRemoval=true
    )

whereas the JDK 9 `javap` prints less useful output.

-Alan
Stephan Herrmann
2018-03-29 22:49:04 UTC
Permalink
Post by Alan Bateman
Post by Stephan Herrmann
I'm looking at jdk.xml.bind/module-info.class from JDK 9.0.4.
I do find a RuntimeVisibleAnnotation attribute representing
but I don't find a Deprecated attribute.
Is this intended? JVMS 4.7.15 neither includes nor excludes
modules, but not generating the Deprecated attribute looks
like an omission to me.
Are you using `javap` to look at the class or something else?
I ask because `javap` tool was updated in JDK 10 to render annotations in a more friendly way. When I use the JDK 10 `javap` to look
  0: #5(#6=s#7,#8=Z#9)
    java.lang.Deprecated(
      since="9"
      forRemoval=true
    )
whereas the JDK 9 `javap` prints less useful output.
I did use JDK 9 javap, but was able to decipher the
RuntimeVisibleAnnotations attribute as you can see above :)
(Still good to know about the improvement in JDK 10).

My question, however, concerns the lack of a Deprecated
*attribute* a la JVMS 4.7.15.

Is that intended or not?

IOW, are compilers expected to evaluate RuntimeVisibleAnnotations
in order to issue deprecation warnings?
In the past this was not necessary.

best,
Stephan
Jonathan Gibbons
2018-03-29 22:56:11 UTC
Permalink
Post by Stephan Herrmann
Post by Alan Bateman
Post by Stephan Herrmann
I'm looking at jdk.xml.bind/module-info.class from JDK 9.0.4.
I do find a RuntimeVisibleAnnotation attribute representing
but I don't find a Deprecated attribute.
Is this intended? JVMS 4.7.15 neither includes nor excludes
modules, but not generating the Deprecated attribute looks
like an omission to me.
Are you using `javap` to look at the class or something else?
I ask because `javap` tool was updated in JDK 10 to render
annotations in a more friendly way. When I use the JDK 10 `javap` to
   0: #5(#6=s#7,#8=Z#9)
     java.lang.Deprecated(
       since="9"
       forRemoval=true
     )
whereas the JDK 9 `javap` prints less useful output.
I did use JDK 9 javap, but was able to decipher the
RuntimeVisibleAnnotations attribute as you can see above :)
(Still good to know about the improvement in JDK 10).
My question, however, concerns the lack of a Deprecated
*attribute* a la JVMS 4.7.15.
Is that intended or not?
IOW, are compilers expected to evaluate RuntimeVisibleAnnotations
in order to issue deprecation warnings?
In the past this was not necessary.
best,
Stephan
Stephan,

Given JEP 277 [1], it is now necessary to read the annotation in order
to determine if the annotated item has been deprecated for removal,
and to act accordingly.

-- Jon

[1] http://openjdk.java.net/jeps/277
Stephan Herrmann
2018-03-29 23:02:11 UTC
Permalink
Post by Jonathan Gibbons
Post by Stephan Herrmann
Post by Alan Bateman
Post by Stephan Herrmann
I'm looking at jdk.xml.bind/module-info.class from JDK 9.0.4.
I do find a RuntimeVisibleAnnotation attribute representing
but I don't find a Deprecated attribute.
Is this intended? JVMS 4.7.15 neither includes nor excludes
modules, but not generating the Deprecated attribute looks
like an omission to me.
Are you using `javap` to look at the class or something else?
I ask because `javap` tool was updated in JDK 10 to render annotations in a more friendly way. When I use the JDK 10 `javap` to
   0: #5(#6=s#7,#8=Z#9)
     java.lang.Deprecated(
       since="9"
       forRemoval=true
     )
whereas the JDK 9 `javap` prints less useful output.
I did use JDK 9 javap, but was able to decipher the
RuntimeVisibleAnnotations attribute as you can see above :)
(Still good to know about the improvement in JDK 10).
My question, however, concerns the lack of a Deprecated
*attribute* a la JVMS 4.7.15.
Is that intended or not?
IOW, are compilers expected to evaluate RuntimeVisibleAnnotations
in order to issue deprecation warnings?
In the past this was not necessary.
best,
Stephan
Stephan,
Given JEP 277 [1], it is now necessary to read the annotation in order
to determine if the annotated item has been deprecated for removal,
and to act accordingly.
That's true, I was just hoping, we could skip evaluating
RuntimeVisibleAnnotations if no Deprecated attribute is found.

Is using Deprecated attributes now deprecated ? :p

Stephan
Jonathan Gibbons
2018-03-29 23:23:19 UTC
Permalink
Post by Stephan Herrmann
Post by Jonathan Gibbons
Post by Stephan Herrmann
Post by Alan Bateman
Post by Stephan Herrmann
I'm looking at jdk.xml.bind/module-info.class from JDK 9.0.4.
I do find a RuntimeVisibleAnnotation attribute representing
but I don't find a Deprecated attribute.
Is this intended? JVMS 4.7.15 neither includes nor excludes
modules, but not generating the Deprecated attribute looks
like an omission to me.
Are you using `javap` to look at the class or something else?
I ask because `javap` tool was updated in JDK 10 to render
annotations in a more friendly way. When I use the JDK 10 `javap`
   0: #5(#6=s#7,#8=Z#9)
     java.lang.Deprecated(
       since="9"
       forRemoval=true
     )
whereas the JDK 9 `javap` prints less useful output.
I did use JDK 9 javap, but was able to decipher the
RuntimeVisibleAnnotations attribute as you can see above :)
(Still good to know about the improvement in JDK 10).
My question, however, concerns the lack of a Deprecated
*attribute* a la JVMS 4.7.15.
Is that intended or not?
IOW, are compilers expected to evaluate RuntimeVisibleAnnotations
in order to issue deprecation warnings?
In the past this was not necessary.
best,
Stephan
Stephan,
Given JEP 277 [1], it is now necessary to read the annotation in order
to determine if the annotated item has been deprecated for removal,
and to act accordingly.
That's true, I was just hoping, we could skip evaluating
RuntimeVisibleAnnotations if no Deprecated attribute is found.
Is using Deprecated attributes now deprecated ? :p
Stephan
Stephan,

Check these rules [1] which apply for class files with ACC_MODULE set:

*

|attributes|: One|Module|attribute must be present. Except
for|Module|,|ModulePackages|,|ModuleMainClass|,|InnerClasses|,|SourceFile|,|SourceDebugExtension|,|RuntimeVisibleAnnotations|,
and|RuntimeInvisibleAnnotations|, none of the pre-defined attributes
(§4.7
<https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.7>)
may appear.

-- Jon

[1]
https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.1
(see the end of this section)
Stephan Herrmann
2018-03-29 23:53:22 UTC
Permalink
Thanks, Jon, that's exactly what I was looking for.

Stephan
Post by Jonathan Gibbons
Post by Stephan Herrmann
Post by Jonathan Gibbons
Post by Stephan Herrmann
Post by Alan Bateman
Post by Stephan Herrmann
I'm looking at jdk.xml.bind/module-info.class from JDK 9.0.4.
I do find a RuntimeVisibleAnnotation attribute representing
but I don't find a Deprecated attribute.
Is this intended? JVMS 4.7.15 neither includes nor excludes
modules, but not generating the Deprecated attribute looks
like an omission to me.
Are you using `javap` to look at the class or something else?
I ask because `javap` tool was updated in JDK 10 to render annotations in a more friendly way. When I use the JDK 10 `javap` to
   0: #5(#6=s#7,#8=Z#9)
     java.lang.Deprecated(
       since="9"
       forRemoval=true
     )
whereas the JDK 9 `javap` prints less useful output.
I did use JDK 9 javap, but was able to decipher the
RuntimeVisibleAnnotations attribute as you can see above :)
(Still good to know about the improvement in JDK 10).
My question, however, concerns the lack of a Deprecated
*attribute* a la JVMS 4.7.15.
Is that intended or not?
IOW, are compilers expected to evaluate RuntimeVisibleAnnotations
in order to issue deprecation warnings?
In the past this was not necessary.
best,
Stephan
Stephan,
Given JEP 277 [1], it is now necessary to read the annotation in order
to determine if the annotated item has been deprecated for removal,
and to act accordingly.
That's true, I was just hoping, we could skip evaluating
RuntimeVisibleAnnotations if no Deprecated attribute is found.
Is using Deprecated attributes now deprecated ? :p
Stephan
Stephan,
 *
   |attributes|: One|Module|attribute must be present. Except
   for|Module|,|ModulePackages|,|ModuleMainClass|,|InnerClasses|,|SourceFile|,|SourceDebugExtension|,|RuntimeVisibleAnnotations|,
   and|RuntimeInvisibleAnnotations|, none of the pre-defined attributes
   (§4.7
   <https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.7>)
   may appear.
-- Jon
[1] https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.1 (see the end of this section)
Loading...