Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8081657

Issue while compile with "incompatible types: CAP#1 cannot be converted to int"

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • 8u45, 9
    • tools
    • x86
    • os_x

      FULL PRODUCT VERSION :
      java version "1.8.0_45"
      Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
      Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Darwin B 14.3.0 Darwin Kernel Version 14.3.0: Mon Mar 23 11:59:05 PDT 2015; root:xnu-2782.20.48~5/RELEASE_X86_64 x86_64


      A DESCRIPTION OF THE PROBLEM :
      When compiling a class with javac, I get an error. Conpiling in Eclipse is OK

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      mvn clean install

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Compilation would work, possibly a CLassCastException or NPE at runtime
      ACTUAL -
      compilation fail

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      CompilFail.java:[12,89] error: incompatible types: CAP#1 cannot be converted to int


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------

      public class CompilFail {
      protected boolean checkRegexCouldBenextToApply(Map<Map<String, ?>, Integer> proposalToRegexPrice) {
      return proposalToRegexPrice
      .entrySet()
      .stream()
      .allMatch(
      q -> q.getValue().intValue() == 123
      || candidatePriceMatchExpectedPrice(q.getValue().intValue(), (int) q.getKey().get("SomeString")));
      }

      private boolean candidatePriceMatchExpectedPrice(int intValue, int i) {
      // TODO Auto-generated method stub
      return false;
      }
      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :

      public class CompilFail {
      protected boolean checkRegexCouldBenextToApply(Map<Map<String, ?>, Integer> proposalToRegexPrice) {
      return proposalToRegexPrice
      .entrySet()
      .stream()
      .allMatch(
      q -> q.getValue().intValue() == 123
      || candidatePriceMatchExpectedPrice(q.getValue().intValue(), (Integer) q.getKey().get("SomeString")));
      }

      private boolean candidatePriceMatchExpectedPrice(int intValue, int i) {
      // TODO Auto-generated method stub
      return false;
      }
      }


            mcimadamore Maurizio Cimadamore
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: