# JVM target: Duplicate field on class ...: \<init\> ()V

**URL:** https://community.haxe.org/t/jvm-target-duplicate-field-on-class-init-v/2510
**Category:** Haxe
**Tags:** haxe-jvm
**Created:** [June 9, 2020, 12:28pm UTC](https://community.haxe.org/t/jvm-target-duplicate-field-on-class-init-v/2510 "2020-06-09T12:28:55Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![ianharrigan](https://community.haxe.org/user_avatar/community.haxe.org/ianharrigan/32/52_2.png) [@ianharrigan](https://community.haxe.org/u/ianharrigan)
#### Post date: [June 9, 2020, 12:28pm UTC](https://community.haxe.org/t/jvm-target-duplicate-field-on-class-init-v/2510/1 "2020-06-09T12:28:55Z")

</div>

Howdy,

So I thought i would take the new jvm target for a spin and hit this problem:

```haxe
Duplicate field on class haxe.ui.core.ComponentLayout: <init> ()V

```

Is there anyway to get more information on this error? Im pretty sure the field that is duplicated isnt “init” as there is no init function, the line numbers just lead to a @:build macro (which does various things wrt to fields - so likely its _something_ in there), and `dump=pretty` doesnt really give me any other clues either.

This all seems to work on other targets (including hxJava) so im wondering if this is a jvm bug or some iffy macro that ive written that was OK for the older targets - so id ideally like to get more information about it (`--verbose` didnt really point me to anything useful either).

Any clues / pointers?

Cheers,  
Ian

---

<div class="post-metadata">

### Author: ![nadako](https://community.haxe.org/user_avatar/community.haxe.org/nadako/32/5_2.png) [@nadako](https://community.haxe.org/u/nadako)
#### Post date: [June 9, 2020, 12:33pm UTC](https://community.haxe.org/t/jvm-target-duplicate-field-on-class-init-v/2510/2 "2020-06-09T12:33:45Z")

</div>

Do you get this at run-time? That surely looks like a compiler issue, please report 🙂

---

<div class="post-metadata">

### Author: ![Simn](https://community.haxe.org/user_avatar/community.haxe.org/simn/32/388_2.png) [@Simn](https://community.haxe.org/u/Simn)
#### Post date: [June 9, 2020, 12:36pm UTC](https://community.haxe.org/t/jvm-target-duplicate-field-on-class-init-v/2510/3 "2020-06-09T12:36:05Z")

</div>

Note that `<init>` is the constructor.

---

<div class="post-metadata">

### Author: ![ianharrigan](https://community.haxe.org/user_avatar/community.haxe.org/ianharrigan/32/52_2.png) [@ianharrigan](https://community.haxe.org/u/ianharrigan)
#### Post date: [June 9, 2020, 12:36pm UTC](https://community.haxe.org/t/jvm-target-duplicate-field-on-class-init-v/2510/4 "2020-06-09T12:36:16Z")

</div>

I dont - i get this at compile time - the problem with reporting it as an issue is the haxeui-core dependency, which is pretty big. Ill spend a bit of time seeing if i can get the same thing to happen in a minimal test - any ideas if there is a way to know what the field that it thinks is duplicated is?

Thanks,  
Ian

---

<div class="post-metadata">

### Author: ![ianharrigan](https://community.haxe.org/user_avatar/community.haxe.org/ianharrigan/32/52_2.png) [@ianharrigan](https://community.haxe.org/u/ianharrigan)
#### Post date: [June 9, 2020, 12:37pm UTC](https://community.haxe.org/t/jvm-target-duplicate-field-on-class-init-v/2510/5 "2020-06-09T12:37:04Z")

</div>

Ah, OK, so its saying the field that is duplicated is a constructor, noted - ill see if i can get something minimal together.

---

<div class="post-metadata">

### Author: ![ianharrigan](https://community.haxe.org/user_avatar/community.haxe.org/ianharrigan/32/52_2.png) [@ianharrigan](https://community.haxe.org/u/ianharrigan)
#### Post date: [June 9, 2020, 12:50pm UTC](https://community.haxe.org/t/jvm-target-duplicate-field-on-class-init-v/2510/6 "2020-06-09T12:50:50Z")

</div>

That was easy 🙂

> <https://github.com/HaxeFoundation/haxe/issues/9548>
>
> It seems that, in the jvm target, when you have a class hierarchy and without two or more constructors the compiler...
