Source:
<code>public void extractionFunction() { SolutionDescriptor<TestdataConstraintConfigurationSolution> solutionDescriptor = TestdataConstraintConfigurationSolution .buildSolutionDescriptor(); ConstraintConfigurationDescriptor<TestdataConstraintConfigurationSolution> constraintConfigurationDescriptor = solutionDescriptor.getConstraintConfigurationDescriptor(); ConstraintWeightDescriptor<TestdataConstraintConfigurationSolution> firstWeightDescriptor = constraintConfigurationDescriptor.getConstraintWeightDescriptor("firstWeight"); assertThat(firstWeightDescriptor.getConstraintPackage()) .isEqualTo(TestdataConstraintConfigurationSolution.class.getPackage().getName()); assertThat(firstWeightDescriptor.getConstraintName()).isEqualTo("First weight"); ConstraintWeightDescriptor<TestdataConstraintConfigurationSolution> secondWeightDescriptor = constraintConfigurationDescriptor.getConstraintWeightDescriptor("secondWeight"); assertThat(secondWeightDescriptor.getConstraintPackage()).isEqualTo("packageOverwrittenOnField"); assertThat(secondWeightDescriptor.getConstraintName()).isEqualTo("Second weight"); TestdataConstraintConfigurationSolution solution = new TestdataConstraintConfigurationSolution("solution"); TestdataConstraintConfiguration constraintConfiguration = new TestdataConstraintConfiguration( "constraintConfiguration"); constraintConfiguration.setFirstWeight(SimpleScore.ZERO); constraintConfiguration.setSecondWeight(SimpleScore.of(7)); solution.setConstraintConfiguration(constraintConfiguration); assertThat(solutionDescriptor.getConstraintConfigurationMemberAccessor().executeGetter(solution)) .isSameAs(constraintConfiguration); assertThat(firstWeightDescriptor.createExtractor().apply(solution)).isEqualTo( <START> (org.optaplanner.core.api.score.Score<? extends org.optaplanner.core.api.score.Score>) SimpleScore.ZERO); <END> assertThat(secondWeightDescriptor.createExtractor().apply(solution)).isEqualTo( (org.optaplanner.core.api.score.Score<? extends org.optaplanner.core.api.score.Score>) SimpleScore.of(7)); }</code><technical_language>Redundant cast</technical_language>

Target:
public void extractionFunction() { SolutionDescriptor<TestdataConstraintConfigurationSolution> solutionDescriptor = TestdataConstraintConfigurationSolution .buildSolutionDescriptor(); ConstraintConfigurationDescriptor<TestdataConstraintConfigurationSolution> constraintConfigurationDescriptor = solutionDescriptor.getConstraintConfigurationDescriptor(); ConstraintWeightDescriptor<TestdataConstraintConfigurationSolution> firstWeightDescriptor = constraintConfigurationDescriptor.getConstraintWeightDescriptor("firstWeight"); assertThat(firstWeightDescriptor.getConstraintPackage()) .isEqualTo(TestdataConstraintConfigurationSolution.class.getPackage().getName()); assertThat(firstWeightDescriptor.getConstraintName()).isEqualTo("First weight"); ConstraintWeightDescriptor<TestdataConstraintConfigurationSolution> secondWeightDescriptor = constraintConfigurationDescriptor.getConstraintWeightDescriptor("secondWeight"); assertThat(secondWeightDescriptor.getConstraintPackage()).isEqualTo("packageOverwrittenOnField"); assertThat(secondWeightDescriptor.getConstraintName()).isEqualTo("Second weight"); TestdataConstraintConfigurationSolution solution = new TestdataConstraintConfigurationSolution("solution"); TestdataConstraintConfiguration constraintConfiguration = new TestdataConstraintConfiguration( "constraintConfiguration"); constraintConfiguration.setFirstWeight(SimpleScore.ZERO); constraintConfiguration.setSecondWeight(SimpleScore.of(7)); solution.setConstraintConfiguration(constraintConfiguration); assertThat(solutionDescriptor.getConstraintConfigurationMemberAccessor().executeGetter(solution)) .isSameAs(constraintConfiguration); assertThat(firstWeightDescriptor.createExtractor().apply(solution)).isEqualTo(SimpleScore.ZERO); assertThat(secondWeightDescriptor.createExtractor().apply(solution)).isEqualTo(SimpleScore.of(7)); }