[Java] '<>' operator is not allowed for source level below 1.7

2022. 11. 28. 10:11·🚀 from error to study/Java

 

 

 

📍 '<>' operator is not allowed for source level below 1.7

👉🏻 메시지를 해석해 보면 자바 1.7 버전 및으로는 <>(생략된 꼴)이 허락되지 않는다는 뜻

👉🏻 원래 ArrayList를 선언 및 초기화 할 때는 new 구문 뒤에 <> 안의 제네릭 설정을 할 필요 없다고 배웠는데 갑자기 오류가 뜸

 

 

 

👉🏻 pom.xml 파일을 확인해 보니 새로운 프로젝트 생성하면서 기본 설정인 자바 1.6을 그대로 쓰고 있었음

 

 

 

👉🏻 JDK 8 버전 쓸 때는 new 구문 뒤 문법상 <제네릭> 생략이 가능했으나 6 버전에서는 생략 불가함!

 

 

 

👉🏻 <Member>라는 선언하는 형과 같은 제네릭을 넣어 주면 오류 사라짐

저작자표시 비영리 변경금지 (새창열림)
'🚀 from error to study/Java' 카테고리의 다른 글
  • [JSTL] JSTL 구문 적용했을 때 CSS 안 먹힘
  • [Spring] Spring Explorer상에 Beans 폴더가 안 보일 때 (ClassNotFoundException)
  • [STS] The archive: C:/dev/apache-tomcat-8.5.82/bin/bootstrap.jar which is referenced by the classpath, does not exist.
  • [Spring/Eclipse] 'Periodic workspace save.' has encountered a problem. Could note write metadata for '/Servers'.
천재강쥐
천재강쥐
  • 천재강쥐
    디버거도 버거다
    천재강쥐
  • 전체
    오늘
    어제
    • Category (467)
      • 진짜 너무 궁금한데 이걸 나만 몰라...? (0)
      • 💾 Portfolio (2)
      • 🐤 CodingTest (28)
        • Java (20)
        • ᕕ(ꐦ°᷄д°᷅)ᕗ❌ (5)
      • 🚀 from error to study (142)
        • AI (1)
        • Cloud (2)
        • DB (12)
        • Front-End (16)
        • Github (14)
        • Java (39)
        • Mac (7)
        • Normal (29)
        • Server (22)
      • 📘 certificate (44)
        • 📘 리눅스마스터1급 (1)
        • 📘⭕️ 정보처리기사 (40)
        • 📘⭕️ SQLD (3)
      • 📗 self-study (234)
        • 📗 inflearn (35)
        • 📗 생활코딩 (8)
        • 📗 KH정보교육원 당산지원 (190)
      • 🎨 Scoop the others (0)
        • 📖 Peeking into other people.. (0)
        • 🇫🇷 (0)
        • 📘⭕️ 한국사능력검정시험 심화 (11)
        • 오블완 (4)
  • 인기 글

  • hELLO· Designed By정상우.v4.10.1
천재강쥐
[Java] '<>' operator is not allowed for source level below 1.7
상단으로

티스토리툴바