The type java.lang.CharSequence cannot be resolved in package declaration

user3712116

I get 2 classes in package P. Interface class A and its implementation class B. In the file with class B I get the following error: The type java.lang.CharSequence cannot be resolved. It is indirectly referenced from required .class files.

I'm using Eclipse Helios and

$ java -version
java version "1.8.0_05"
Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
Java HotSpot(TM) Server VM (build 25.5-b02, mixed mode)

Standard solution of removing and adding JRE doesn't work. How can I fix it?

EDIT: Code:
Class A:

package com.jax;

import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.Style;


@WebService
@SOAPBinding(style = Style.RPC)
public interface WebServiceInter {

@WebMethod
String sayHello();

}

Class B:

package com.jax; // **Error is here**

import javax.jws.WebService;

@WebService(endpointInterface = "com.jax.WebServiceInter")
public class WebServiceImpl implements WebServiceInter{
    @Override
    public String sayHello(){
        return "Hello!";
    }
}

Project structure: ProjectName -> Java Resources -> com.jax -> Class A, Class B

mkrakhin

Java 8 supports default methods in interfaces. And in JDK 8 a lot of old interfaces now have new default methods. For example, now in CharSequence we have chars and codePoints methods.
If source level of your project is lower than 1.8, then compiler doesn't allow you to use default methods in interfaces. So it cannot compile classes that directly on indirectly depend on this interfaces.
If I get your problem right, then you have two solutions. First solution is to rollback to JDK 7, then you will use old CharSequence interface without default methods. Second solution is to set source level of your project to 1.8, then your compiler will not complain about default methods in interfaces.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

The type java.lang.CharSequence cannot be resolved

From Dev

Eclipse Error: java.lang.CharSequence cannot be resolved

From Dev

java.lang.CharSequence cannot be resolved when using drawString

From Dev

Error when using sendKeys() with Selenium WebDriver Java.lang.CharSequence cannot be resolved

From Dev

Package/Class cannot be resolved to a type

From Dev

Java: cannot be resolved to a type

From Dev

operator + cannot be applied to java.lang.charsequence

From Dev

var cannot be resolved to a type - java-10

From Dev

my variable cannot be resolved into a type in java

From Java

Java project in Eclipse: The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files

From Dev

Building WALA on osx "the import java.lang.invoke cannot be resolved"

From Dev

Firebase cannot be resolved to a type

From Dev

WakefulBroadcastReceiver cannot be resolved to a type

From Dev

EnableTransactionManagement cannot be resolved to a type

From Dev

NotificationCompat cannot be resolved to a type

From Dev

JSONObject cannot be resolved to a type

From Dev

ActionBarActivity: cannot be resolved to a type

From Dev

WebServlet cannot be resolved to a type

From Dev

IDocument cannot be resolved to a type

From Dev

<T> cannot be resolved to a type?

From Dev

Rest Cannot be resolved to a type

From Dev

ResultSet cannot be resolved to a type

From Dev

DatePicker cannot be resolved to a type

From Dev

JPEGMetadata cannot be resolved to a type

From Dev

HttpClient cannot be resolved to a type

From Dev

HttpJUnitRunner cannot be resolved to a type

From Dev

EnableWebSecurity cannot be resolved to a type

From Dev

EnableConfigServer cannot be resolved to a type

From Dev

Entity cannot be resolved to a type

Related Related

  1. 1

    The type java.lang.CharSequence cannot be resolved

  2. 2

    Eclipse Error: java.lang.CharSequence cannot be resolved

  3. 3

    java.lang.CharSequence cannot be resolved when using drawString

  4. 4

    Error when using sendKeys() with Selenium WebDriver Java.lang.CharSequence cannot be resolved

  5. 5

    Package/Class cannot be resolved to a type

  6. 6

    Java: cannot be resolved to a type

  7. 7

    operator + cannot be applied to java.lang.charsequence

  8. 8

    var cannot be resolved to a type - java-10

  9. 9

    my variable cannot be resolved into a type in java

  10. 10

    Java project in Eclipse: The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files

  11. 11

    Building WALA on osx "the import java.lang.invoke cannot be resolved"

  12. 12

    Firebase cannot be resolved to a type

  13. 13

    WakefulBroadcastReceiver cannot be resolved to a type

  14. 14

    EnableTransactionManagement cannot be resolved to a type

  15. 15

    NotificationCompat cannot be resolved to a type

  16. 16

    JSONObject cannot be resolved to a type

  17. 17

    ActionBarActivity: cannot be resolved to a type

  18. 18

    WebServlet cannot be resolved to a type

  19. 19

    IDocument cannot be resolved to a type

  20. 20

    <T> cannot be resolved to a type?

  21. 21

    Rest Cannot be resolved to a type

  22. 22

    ResultSet cannot be resolved to a type

  23. 23

    DatePicker cannot be resolved to a type

  24. 24

    JPEGMetadata cannot be resolved to a type

  25. 25

    HttpClient cannot be resolved to a type

  26. 26

    HttpJUnitRunner cannot be resolved to a type

  27. 27

    EnableWebSecurity cannot be resolved to a type

  28. 28

    EnableConfigServer cannot be resolved to a type

  29. 29

    Entity cannot be resolved to a type

HotTag

Archive