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

java.lang.AssertionError: Missing type variable in where clause K

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 7u76
    • tools
    • x86
    • windows_7

      FULL PRODUCT VERSION :
      java version "1.7.0_51"
      Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
      Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.1.7601]

      A DESCRIPTION OF THE PROBLEM :
      While trying to do a build to create a Jira plugin, I encountered the following error"

      C:\atlastutorial\combobox>atlas-run --product jira --version 6.1
      Executing: "C:\Users\AEI9YB\atlassian-plugin-sdk\apache-maven\bin\mvn.bat" com.a
      tlassian.maven.plugins:maven-amps-dispatcher-plugin:4.2.18:run -gs C:\Users\AEI9
      YB\atlassian-plugin-sdk\apache-maven/conf/settings.xml -Dproduct=jira -Dproduct.
      version=6.1
      [INFO] Scanning for projects...
      [INFO] ------------------------------------------------------------------------
      [INFO] Building combobox
      [INFO] task-segment: [com.atlassian.maven.plugins:maven-amps-dispatcher-plugi
      n:4.2.18:run]
      [INFO] ------------------------------------------------------------------------
      [INFO] Preparing amps-dispatcher:run
      [INFO] [amps:copy-bundled-dependencies]
      [INFO] [dependency:unpack-dependencies]
      [INFO] gson-2.2.2-atlassian-1.jar already exists in destination.
      [INFO] [amps:compress-resources]
      [INFO] Compiling javascript using YUI
      [INFO] Nothing to do, C:\atlastutorial\combobox\target\classes\js\combobox-min.j
      s is younger than the original
      [INFO] Nothing to do, C:\atlastutorial\combobox\target\classes\css\combobox-min.
      css is younger than the original
      [INFO] Compressing XML files
      [INFO] Nothing to do, C:\atlastutorial\combobox\target\classes\atlassian-plugin.
      xml is younger than the original
      [INFO] [resources:resources]
      [WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources,
      i.e. build is platform dependent!
      [INFO] Copying 8 resources
      [INFO] [amps:filter-plugin-descriptor]
      [INFO] [resources:copy-resources {execution: virtual-execution}]
      [INFO] Using 'UTF-8' encoding to copy filtered resources.
      [INFO] Copying 1 resource
      [INFO] [compiler:compile]
      [INFO] Compiling 1 source file to C:\atlastutorial\combobox\target\classes
      [INFO] ------------------------------------------------------------------------
      [ERROR] BUILD FAILURE
      [INFO] ------------------------------------------------------------------------
      [INFO] Compilation failure
      Failure executing javac, but could not parse the error:
      An exception has occurred in the compiler (1.7.0_51). Please file a bug at the J
      ava Developer Connection (http://java.sun.com/webapps/bugreport) after checking
       the Bug Parade for duplicates. Include your program and the following diagnosti
      c in your report. Thank you.
      java.lang.AssertionError: Missing type variable in where clause K
              at com.sun.tools.javac.util.RichDiagnosticFormatter.unique(RichDiagnosti
      cFormatter.java:234)
              at com.sun.tools.javac.util.RichDiagnosticFormatter.access$100(RichDiagn
      osticFormatter.java:67)
              at com.sun.tools.javac.util.RichDiagnosticFormatter$RichPrinter.visitTyp
      eVar(RichDiagnosticFormatter.java:384)
              at com.sun.tools.javac.util.RichDiagnosticFormatter$RichPrinter.visitTyp
      eVar(RichDiagnosticFormatter.java:326)
              at com.sun.tools.javac.code.Type$TypeVar.accept(Type.java:1030)
              at com.sun.tools.javac.code.Printer.visit(Printer.java:131)


      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      C:\atlastutorial\combobox>atlas-run --product jira --version 6.1
      Executing: "C:\Users\AEI9YB\atlassian-plugin-sdk\apache-maven\bin\mvn.bat" com.a
      tlassian.maven.plugins:maven-amps-dispatcher-plugin:4.2.18:run -gs C:\Users\AEI9
      YB\atlassian-plugin-sdk\apache-maven/conf/settings.xml -Dproduct=jira -Dproduct.
      version=6.1
      [INFO] Scanning for projects...
      [INFO] ------------------------------------------------------------------------
      [INFO] Building combobox
      [INFO] task-segment: [com.atlassian.maven.plugins:maven-amps-dispatcher-plugi
      n:4.2.18:run]
      [INFO] ------------------------------------------------------------------------
      [INFO] Preparing amps-dispatcher:run
      [INFO] [amps:copy-bundled-dependencies]
      [INFO] [dependency:unpack-dependencies]
      [INFO] gson-2.2.2-atlassian-1.jar already exists in destination.
      [INFO] [amps:compress-resources]
      [INFO] Compiling javascript using YUI
      [INFO] Nothing to do, C:\atlastutorial\combobox\target\classes\js\combobox-min.j
      s is younger than the original
      [INFO] Nothing to do, C:\atlastutorial\combobox\target\classes\css\combobox-min.
      css is younger than the original
      [INFO] Compressing XML files
      [INFO] Nothing to do, C:\atlastutorial\combobox\target\classes\atlassian-plugin.
      xml is younger than the original
      [INFO] [resources:resources]
      [WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources,
      i.e. build is platform dependent!
      [INFO] Copying 8 resources
      [INFO] [amps:filter-plugin-descriptor]
      [INFO] [resources:copy-resources {execution: virtual-execution}]
      [INFO] Using 'UTF-8' encoding to copy filtered resources.
      [INFO] Copying 1 resource
      [INFO] [compiler:compile]
      [INFO] Compiling 1 source file to C:\atlastutorial\combobox\target\classes
      [INFO] ------------------------------------------------------------------------
      [ERROR] BUILD FAILURE
      [INFO] ------------------------------------------------------------------------
      [INFO] Compilation failure
      Failure executing javac, but could not parse the error:
      An exception has occurred in the compiler (1.7.0_51). Please file a bug at the J
      ava Developer Connection (http://java.sun.com/webapps/bugreport) after checking
       the Bug Parade for duplicates. Include your program and the following diagnosti
      c in your report. Thank you.
      java.lang.AssertionError: Missing type variable in where clause K
              at com.sun.tools.javac.util.RichDiagnosticFormatter.unique(RichDiagnosti
      cFormatter.java:234)
              at com.sun.tools.javac.util.RichDiagnosticFormatter.access$100(RichDiagn
      osticFormatter.java:67)
              at com.sun.tools.javac.util.RichDiagnosticFormatter$RichPrinter.visitTyp
      eVar(RichDiagnosticFormatter.java:384)
              at com.sun.tools.javac.util.RichDiagnosticFormatter$RichPrinter.visitTyp
      eVar(RichDiagnosticFormatter.java:326)
              at com.sun.tools.javac.code.Type$TypeVar.accept(Type.java:1030)
              at com.sun.tools.javac.code.Printer.visit(Printer.java:131)
              at com.sun.tools.javac.code.Printer.visitTypes(Printer.java:103)
              at com.sun.tools.javac.code.Printer.visitClassType(Printer.java:194)
              at com.sun.tools.javac.util.RichDiagnosticFormatter$RichPrinter.visitCla
      ssType(RichDiagnosticFormatter.java:366)
              at com.sun.tools.javac.util.RichDiagnosticFormatter$RichPrinter.visitCla
      ssType(RichDiagnosticFormatter.java:326)
              at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:583)
              at com.sun.tools.javac.code.Printer.visit(Printer.java:131)
              at com.sun.tools.javac.code.Printer.className(Printer.java:262)
              at com.sun.tools.javac.util.RichDiagnosticFormatter$RichPrinter.classNam
      e(RichDiagnosticFormatter.java:374)
              at com.sun.tools.javac.code.Printer.visitClassType(Printer.java:190)
              at com.sun.tools.javac.util.RichDiagnosticFormatter$RichPrinter.visitCla
      ssType(RichDiagnosticFormatter.java:366)
              at com.sun.tools.javac.util.RichDiagnosticFormatter$RichPrinter.visitCla
      ssType(RichDiagnosticFormatter.java:326)
              at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:583)
              at com.sun.tools.javac.code.Printer.visit(Printer.java:131)
              at com.sun.tools.javac.util.AbstractDiagnosticFormatter.formatArgument(A
      bstractDiagnosticFormatter.java:187)
              at com.sun.tools.javac.util.AbstractDiagnosticFormatter.formatIterable(A
      bstractDiagnosticFormatter.java:216)
              at com.sun.tools.javac.util.AbstractDiagnosticFormatter.formatArgument(A
      bstractDiagnosticFormatter.java:184)
              at com.sun.tools.javac.util.AbstractDiagnosticFormatter.formatArguments(
      AbstractDiagnosticFormatter.java:158)
              at com.sun.tools.javac.util.BasicDiagnosticFormatter.formatMessage(Basic
      DiagnosticFormatter.java:111)
              at com.sun.tools.javac.util.BasicDiagnosticFormatter.formatMeta(BasicDia
      gnosticFormatter.java:184)
              at com.sun.tools.javac.util.BasicDiagnosticFormatter.formatDiagnostic(Ba
      sicDiagnosticFormatter.java:100)
              at com.sun.tools.javac.util.AbstractDiagnosticFormatter.format(AbstractD
      iagnosticFormatter.java:114)
              at com.sun.tools.javac.util.RichDiagnosticFormatter.format(RichDiagnosti
      cFormatter.java:112)
              at com.sun.tools.javac.util.RichDiagnosticFormatter.format(RichDiagnosti
      cFormatter.java:67)
              at com.sun.tools.javac.util.Log.writeDiagnostic(Log.java:434)
              at com.sun.tools.javac.util.Log.report(Log.java:416)
              at com.sun.tools.javac.comp.Resolve.logResolveError(Resolve.java:1828)
              at com.sun.tools.javac.comp.Resolve.access(Resolve.java:1296)
              at com.sun.tools.javac.comp.Resolve.access(Resolve.java:1311)
              at com.sun.tools.javac.comp.Resolve.resolveConstructor(Resolve.java:1584
      )
              at com.sun.tools.javac.comp.Attr.visitNewClass(Attr.java:1734)
              at com.sun.tools.javac.tree.JCTree$JCNewClass.accept(JCTree.java:1372)
              at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:431)
              at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:418)
              at com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:449)
              at com.sun.tools.javac.comp.Attr.visitVarDef(Attr.java:887)
              at com.sun.tools.javac.tree.JCTree$JCVariableDecl.accept(JCTree.java:725
      )
              at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:431)
              at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:418)
              at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:480)
              at com.sun.tools.javac.comp.Attr.attribStats(Attr.java:496)
              at com.sun.tools.javac.comp.Attr.visitBlock(Attr.java:918)
              at com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:781)
              at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:431)
              at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:418)
              at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:480)
              at com.sun.tools.javac.comp.Attr.visitMethodDef(Attr.java:836)
              at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:669)
              at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:431)
              at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:418)
              at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:480)
              at com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:3250)
              at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:3173)
              at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:3109)
              at com.sun.tools.javac.comp.Attr.attrib(Attr.java:3083)
              at com.sun.tools.javac.main.JavaCompiler.attribute(JavaCompiler.java:118
      4)
              at com.sun.tools.javac.main.JavaCompiler.compile2(JavaCompiler.java:870)

              at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:829)
              at com.sun.tools.javac.main.Main.compile(Main.java:439)
              at com.sun.tools.javac.main.Main.compile(Main.java:353)
              at com.sun.tools.javac.main.Main.compile(Main.java:342)
              at com.sun.tools.javac.main.Main.compile(Main.java:333)
              at com.sun.tools.javac.Main.compile(Main.java:94)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
      java:57)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:43)
              at java.lang.reflect.Method.invoke(Method.java:606)
              at org.codehaus.plexus.compiler.javac.JavacCompiler.compileInProcess(Jav
      acCompiler.java:420)
              at org.codehaus.plexus.compiler.javac.JavacCompiler.compile(JavacCompile
      r.java:141)
              at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompiler
      Mojo.java:493)
              at org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:114)
              at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPlugi
      nManager.java:483)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defa
      ultLifecycleExecutor.java:678)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLi
      fecycle(DefaultLifecycleExecutor.java:540)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.forkProjectLifecy
      cle(DefaultLifecycleExecutor.java:1168)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.forkLifecycle(Def
      aultLifecycleExecutor.java:1009)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defa
      ultLifecycleExecutor.java:627)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandalone
      Goal(DefaultLifecycleExecutor.java:553)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(Defau
      ltLifecycleExecutor.java:523)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHan
      dleFailures(DefaultLifecycleExecutor.java:371)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegmen
      ts(DefaultLifecycleExecutor.java:332)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLi
      fecycleExecutor.java:181)
              at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:356)
              at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:137)
              at org.apache.maven.cli.MavenCli.main(MavenCli.java:356)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
      java:57)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:43)
              at java.lang.reflect.Method.invoke(Method.java:606)
              at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
              at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
              at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)

              at org.codehaus.classworlds.Launcher.main(Launcher.java:375)


      [INFO] ------------------------------------------------------------------------
      [INFO] For more information, run Maven with the -e switch
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 23 seconds
      [INFO] Finished at: Fri Dec 04 10:12:24 CST 2015
      [INFO] Final Memory: 82M/313M
      [INFO] ------------------------------------------------------------------------

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      package com.emdiesels.jira.plugins.combobox;
       
      import java.io.File;
      import java.io.FileInputStream;
      import java.io.IOException;
      import java.io.InputStreamReader;
      import java.io.Reader;
      import java.net.MalformedURLException;
      import java.net.URL;
      import java.util.Comparator;
      import java.util.HashMap;
      import java.util.Iterator;
      import java.util.List;
      import java.util.Map;
      import java.util.Properties;
      import java.util.SortedSet;
      import java.util.TreeSet;
       
      import org.apache.log4j.Level;
      import org.apache.log4j.Logger;
      import org.dom4j.DocumentException;
       
      import org.dom4j.io.SAXReader;
      import org.xml.sax.InputSource;
       
      import com.atlassian.jira.issue.Issue;
      import com.atlassian.jira.issue.customfields.converters.SelectConverter;
      import com.atlassian.jira.issue.customfields.converters.StringConverter;
      import com.atlassian.jira.issue.customfields.impl.SelectCFType;
      import com.atlassian.jira.issue.customfields.manager.GenericConfigManager;
      import com.atlassian.jira.issue.customfields.manager.OptionsManager;
      import com.atlassian.jira.issue.customfields.persistence.CustomFieldValuePersister;
      import com.atlassian.jira.issue.fields.rest.json.beans.JiraBaseUrls;
      import com.atlassian.jira.issue.fields.CustomField;
      import com.atlassian.jira.issue.fields.config.FieldConfig;
      import com.atlassian.jira.issue.fields.layout.field.FieldLayoutItem;
      import com.atlassian.jira.issue.search.SearchContextImpl;
      import com.atlassian.jira.issue.customfields.option.Option;
       
      /**
       * This is a very sophisticated SELECT field
       * @author kg
       * @since 02.02.2012
       */
      public class ComboboxCFType extends SelectCFType
      {
          /**
           * Custom field specific logger
           */
          private static final Logger log = Logger.getLogger(com.emdiesels.jira.plugins.combobox.ComboboxCFType.class);
       
          /**
           * URL to query all items
           */
          public String url;
       
          /**
           * options manager passed in constructor
           */
          private OptionsManager optionsManager;
       
          public ComboboxCFType(final CustomFieldValuePersister customFieldValuePersister,
      final OptionsManager optionsManager,
      final GenericConfigManager genericConfigManager,
      final JiraBaseUrls jiraBaseUrls) {
      super(customFieldValuePersister, optionsManager, genericConfigManager, jiraBaseUrls);

              this.optionsManager = optionsManager;
       
              log.setLevel(Level.ALL);
              log.info("Combobox constructor");
          }


          static <K,V extends Comparable> SortedSet<Map.Entry> entriesSortedByValues(Map<K,V> map) {
              SortedSet<Map.Entry> sortedEntries = new TreeSet<Map.Entry>(
                  new Comparator<Map.Entry<K,V>>() {
       
       // private String prepare( Object o )
       // {
       // return ((String)o).toLowerCase().replace( 'ä', 'a' )
       // .replace( 'ö', 'o' )
       // .replace( 'ü', 'u' )
      // .replace( 'ß', 's' );
      // }
                         @Override public int compare(Map.Entry<K,V> e1, Map.Entry<K,V> e2) {
                          return e2.getValue().compareTo(e1.getValue() );
                      }
                  }
              );
              sortedEntries.addAll(map.entrySet());
              return sortedEntries;
          }

       
          static boolean containsItem( List<Option> optionList, String value )
          {
              if( optionList == null ) return false;
              for( Option option : optionList )
              {
                  if( option.getValue().indexOf( value ) != -1 )
                      return true;
              }
              return false;
          }

      /*
          public SortedSet<Map.Entry> searchItems()
          {
              Properties properties = new Properties();
              File file = new File("/srv/jira-data/plugins/sophisticated_field_plugin.txt");
              try {
                  properties.load(new FileInputStream(file));
                  this.url = (String) properties.get("url");
              } catch (IOException e) {
                  log.error( "Could not read properties file: " + file.getAbsolutePath() );
              }
              log.info("url:" + url);
       
              log.info("calling searchItems");
              Map m = new HashMap();
              try
              {
                  SAXReader saxReader = new SAXReader();
                  org.dom4j.Document d = saxReader.read( new URL(url) );
       
                  log.info(url);
       
                  List dataNodes = d.getRootElement().elements("data");
       
                  log.info( "dataNodes.length=" + dataNodes.size());
       
                  for (Iterator iterator = dataNodes.iterator(); iterator.hasNext();)
                  {
                      org.dom4j.Element dataNode = (org.dom4j.Element) iterator.next();
       
                      org.dom4j.Element idNode = dataNode.element("id");
                      org.dom4j.Element nameNode = dataNode.element("name");
       
                      String id = idNode.getStringValue();
                      String name = nameNode.getStringValue();
       
                      m.put(id, name);
                  }
              }
              catch (Exception e)
              {
                  log.error("searchItems exception");
                  log.error(e.getMessage());
                  e.printStackTrace();
              }
              return entriesSortedByValues(m);
          }
      */
          public SortedSet<Map.Entry> searchItems()
          {
              Map m = new HashMap();
      m.put("BMW", 5);
      m.put("Audi", 4);

      return entriesSortedByValues(m);
      }

          @Override
          public Map getVelocityParameters(Issue issue,
                  CustomField field,
                  FieldLayoutItem fieldLayoutItem)
          {
              log.info("calling getVelocityParameters");
       
              Map parameters = super.getVelocityParameters(issue, field, fieldLayoutItem);
       
              FieldConfig fieldConfig = null;
              if(issue == null)
              {
                  log.info("issue is null");
                  fieldConfig = field.getReleventConfig(new SearchContextImpl());
              } else {
                  log.info( "issue is not null" );
                  log.info( "issue-id:" + issue.getId() );
                  fieldConfig = field.getRelevantConfig(issue);
              }
       
              log.info("before search items");
             SortedSet<Map.Entry> set = searchItems();
             log.info("==> " + set.size());
       
              List existingOptions = optionsManager.getOptions(fieldConfig);
              log.info("EXISTING-OPTIONS: " + existingOptions.size() );
              /*
              for( Option option : existingOptions )
              {
                  log.info( option.getOptionId() + " ==> " + option.getValue() );
              }
              */
       

              for( Map.Entry el : set )
              {
                  String key = el.getKey();
                  String val = el.getValue();
       
                  String itm = val + " [" + key + "]";
       
                  if(containsItem( existingOptions, key ) ) {
                      //log.info( itm + " found ==> continue" );
                      continue;
                  }
                  log.warn( itm + " NOT FOUND!!!");
                  Option option = optionsManager.createOption(fieldConfig, null, null, itm);
              }

              return parameters;
          }
      }
      ---------- END SOURCE ----------

      SUPPORT :
      YES

            fmatte Fairoz Matte
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: