在常量池中看不到整数值

Can not see integer value in constant pool

这里很简单class.

public class Test{
    private int a = 10;
    private float b = 20.0F;
}

使用javap -v -l Test.class命令查看class文件的结构。在 Constant pool 部分,我应该看到 class 的所有常量。尽管如此,我可以找到float值是20.0f,但找不到int值。

public class Test
  minor version: 0
  major version: 52
  flags: ACC_PUBLIC, ACC_SUPER
Constant pool:
   #1 = Methodref          #6.#17         // java/lang/Object."<init>":()V
   #2 = Fieldref           #5.#18         // Test.a:I
   #3 = Float              20.0f
   #4 = Fieldref           #5.#19         // Test.b:F
   #5 = Class              #20            // Test
   #6 = Class              #21            // java/lang/Object
   #7 = Utf8               a
   #8 = Utf8               I
   #9 = Utf8               b
  #10 = Utf8               F
  #11 = Utf8               <init>
  #12 = Utf8               ()V
  #13 = Utf8               Code
  #14 = Utf8               LineNumberTable
  #15 = Utf8               SourceFile
  #16 = Utf8               Test.java
  #17 = NameAndType        #11:#12        // "<init>":()V
  #18 = NameAndType        #7:#8          // a:I
  #19 = NameAndType        #9:#10         // b:F
  #20 = Utf8               Test
  #21 = Utf8               java/lang/Object
{
  public Test();
    descriptor: ()V
    flags: ACC_PUBLIC
    Code:
      stack=2, locals=1, args_size=1
         0: aload_0
         1: invokespecial #1                  // Method java/lang/Object."<init>":()V
         4: aload_0
         5: bipush        10
         7: putfield      #2                  // Field a:I
        10: aload_0
        11: ldc           #3                  // float 20.0f
        13: putfield      #4                  // Field b:F
        16: return
      LineNumberTable:
        line 1: 0
        line 2: 4
        line 3: 10
}
SourceFile: "Test.java"

根据文档 https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4-140

我应该在常量池中看到 CONSTANT_Integer

有加载小整数值的特殊说明(iconst_x 用于从 -1 到 5 的值,bipush x 用于字节值,sipush x 用于短值)。

常量池仅用于此范围之外的整数值,即小于 -32768 或大于 32767 的数字。