jhipster / generator-jhipster

JHipster is a development platform to quickly generate, develop, & deploy modern web applications & microservice architectures.
https://www.jhipster.tech
Apache License 2.0
21.55k stars 4.02k forks source link

warning for java reserved words in jdl #17694

Closed smunoz2 closed 6 months ago

smunoz2 commented 2 years ago
Overview of the issue

When I try to add an entity using the jdl feature I was getting the following error:


Error: Error parsing file src/test/java/com/nexnavi/aereo/web/rest/CountryResourceIT.java: Error: Sad sad panda, parsing errors detected in line: 101, column: 13!
Expecting: one of these possible Token sequences:
  1. ['.']
  2. ['(']
  3. ['[']
  4. ['.']
  5. ['[']
  6. ['::']
but found: '.'!
...continues.

What I found is that I was using the a java reserved word "native" in one of my entities field. When I renamed the field to "nativePeople" it works.

Motivation for or Use Case

For me this is a bug because the stack error doesn't show a correct error when I run the jhipster jdl command or when I creating my entity in the JDL-Studio

Reproduce the error

Use the following entity to reproduce the error:


entity Country{
name String,
iso3 String,
iso2 String,
numericCode String,
phoneCode String,
capital String,
currency String,
currencyName String,
currencySymbol String,
tld String,
native String, /**this field produce the error **/
region String,
subregion String,
latitude String,
longitude String,
emoji String,
emojiU String
}

Related issues

No

Suggest a Fix
JHipster Version(s)

7.6.0

JHipster configuration, a .yo-rc.json file generated in the root folder
.yo-rc.json file
{
  "generator-jhipster": {
    "applicationType": "monolith",
    "authenticationType": "jwt",
    "baseName": "nexnavi",
    "blueprints": [],
    "buildTool": "gradle",
    "cacheProvider": "redis",
    "clientFramework": "vue",
    "clientPackageManager": "npm",
    "clientTheme": "none",
    "clientThemeVariant": "",
    "creationTimestamp": 1643500735718,
    "databaseType": "mongodb",
    "devDatabaseType": "mongodb",
    "devServerPort": 9060,
    "dtoSuffix": "DTO",
    "enableGradleEnterprise": false,
    "enableHibernateCache": false,
    "enableSwaggerCodegen": false,
    "enableTranslation": true,
    "entities": ["Timezone", "Translations", "States", "City", "Country"],
    "entitySuffix": "",
    "jhiPrefix": "jhi",
    "jhipsterVersion": "7.6.0",
    "jwtSecretKey": "YourJWTSecretKeyWasReplacedByThisMeaninglessTextByTheJHipsterInfoCommandForObviousSecurityReasons",
    "languages": ["es"],
    "lastLiquibaseTimestamp": 1643512779000,
    "messageBroker": false,
    "nativeLanguage": "es",
    "otherModules": [],
    "packageName": "com.nexnavi.aereo",
    "pages": [],
    "prodDatabaseType": "mongodb",
    "reactive": false,
    "searchEngine": false,
    "serverPort": "8080",
    "serverSideOptions": [],
    "serviceDiscoveryType": "no",
    "skipCheckLengthOfIdentifier": false,
    "skipFakeData": false,
    "skipUserManagement": false,
    "testFrameworks": ["cypress"],
    "websocket": false,
    "withAdminUi": true
  }
}

JDL for the Entity configuration(s) entityName.json files generated in the .jhipster directory
JDL entity definitions
entity Timezone {
  zoneName String
  gmtOffset Integer
  gmtOffsetName String
  abbreviation String
  tzName String
}
entity Translations {
  kr String
  br String
  pt String
  nl String
  hr String
  fa String
  de String
  es String
  fr String
  ja String
  it String
  cn String
}
entity States {
  name String
  countryId Integer
  countryCode String
  countryName String
  stateCode String
  type String
  latitude String
  longitude String
}
entity City {
  name String
  stateId Integer
  stateCode String
  stateName String
  countryId Integer
  countryCode String
  countryName String
  latitude String
  longitude String
  wikiDataId String
}
entity Country {
  name String
  iso3 String
  iso2 String
  numericCode String
  phoneCode String
  capital String
  currency String
  currencyName String
  currencySymbol String
  tld String
  native String
  region String
  subregion String
  latitude String
  longitude String
  emoji String
  emojiU String
}

Environment and Tools

openjdk version "11.0.2" 2019-01-15 OpenJDK Runtime Environment 18.9 (build 11.0.2+9) OpenJDK 64-Bit Server VM 18.9 (build 11.0.2+9, mixed mode)

git version 2.33.1

node: v16.6.2

npm: 7.20.6

Docker version 20.10.8, build 3967b7d

docker-compose version 1.29.2, build 5becea4c

Browsers and Operating System

MacOS

github-actions[bot] commented 11 months ago

This issue is stale because it has been open for too long without any activity. Due to the moving nature of jhipster generated application, bugs can become invalid. If this issue still applies please comment otherwise it will be closed in 7 days

github-actions[bot] commented 11 months ago

JHipster has completed the sample check .yo-rc.json: valid Entities JDL: valid Application: successfully generated Frontend check: success Backend check: failure E2E check: success

This check uses jhipster info output from the issue description to generate the sample. Bug report that does not contain this information will be marked as invalid.