Uploaded image for project: 'Commons Lang'
  1. Commons Lang
  2. LANG-1140

lang.reflect.FieldUtils.getAllFields() returns false result

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Not A Problem
    • 3.5
    • Patch Needed
    • lang.reflect.*
    • None
    • Linux ubuntu 3.16.0-38-generic x86_64 GNU/Linux
      java version "1.7.0_79"
      OpenJDK Runtime Environment (IcedTea 2.5.5) (7u79-2.5.5-0ubuntu0.14.10.2)
      OpenJDK 64-Bit Server VM (build 24.79-b02, mixed mode)

    Description

      JUnit test returns errors below.
      FieldUtilsTest.testGetAllFields:154 expected:<5> but was:<7>
      FieldUtilsTest.testGetAllFieldsList:168 expected:<5> but was:<7>

      Both methods has a parameter "FieldUtils.getAllFields(PublicChild.class).length ."
      PublicChild which has 1 field extends Parent which has 4 fields.

      I made a dummy class which contains no field, the result of getAllFields() was 1, not 0.
      Lang-3.4 doesn't have this problem.

      PublicChild2.java
      public class PublicChild2 {
      
      	static final String VALUE = "child";
      }
      
      FieldUtilsTest.java
      assertEquals(1, PublicChild2.class.getDeclaredFields().length);
      

      Result: fails. returns 2

      Attachments

        Activity

          People

            Unassigned Unassigned
            yungho yunghoyi
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: