1

I've read many similiar topics - but they did not fix my issue cause i am having good import:

import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

The issue is following:

The type Iterator is not generic; it cannot be parameterized with arguments <CustomClassName>

I am using JRE 1.8

JRE version

JAVA_HOME Variable is set to C:\Program Files\Java\jdk1.7.0_80

Eclipse Java EE IDE for Web Developers.

Version: Mars.2 Release (4.5.2)
Build id: 20160218-0600

Java compiler: enter image description here

What's wrong??

maven compiler plugin

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.0</version>
            <configuration>
              <source>1.7</source>
              <target>1.7</target>
            </configuration>
        </plugin>
tryingHard
  • 1,794
  • 4
  • 35
  • 74

2 Answers2

2

For me the import was wrong. I was using an IBM class with the same name.

import com.ibm.ws.objectManager.Iterator;

Changed this to the proper import and the error went away:

import java.util.Iterator;
Larry Ricker
  • 199
  • 1
  • 7
1

Maybe this answear from a similar question might help you

It's late but still replying, might be helpful for others who are still facing the issue. I was getting exactly the same issue. The List was proper with util.List. The solution was to order the exports of the libraries. If you are using Maven or any other Libraries :

In Project -> Build Path -> Configure Build Path -> Order & Exports

Check 'JRE System Libraries' should be above 'Maven Dependencies'

This worked for me.

Question

Community
  • 1
  • 1
Edu G
  • 1,030
  • 9
  • 23
  • the option of `JRE` was unchecked there. When i checked it and move it above `Maven dependencies` the errors did got away. This option is automatically unchecked after `Maven update project` option in `Eclipse`. – tryingHard Apr 06 '17 at 13:14