Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Constant field in repeating group produces Java compile error #3

Closed
donmendelson opened this issue Nov 7, 2013 · 4 comments
Closed

Comments

@donmendelson
Copy link

A constant field produced this code in an inner class:

public class MDIncRefresh implements MessageFlyweight
{
..
public class MDEntries implements GroupFlyweight
{
...
private static final byte[] TradingSessionIDValue = {65};

    public int TradingSessionIDLength()
    {
        return 1;
    }

    public byte TradingSessionID(final int index)
    {
        return TradingSessionIDValue[index];
    }

This is the error on the constant declaration:

The field TradingSessionIDValue cannot be declared static; static fields can only be declared in static or top level types MDIncRefresh.java /InteropTester/src/MarketData line 434 Java Problem

@tmontgomery
Copy link
Contributor

This is a constant type within a repeating group, correct?

@donmendelson
Copy link
Author

Correct

Sent from my iPhone

On Nov 7, 2013, at 6:18 PM, "Todd L. Montgomery" <notifications@git.luolix.topmailto:notifications@github.com> wrote:

This is a constant type within a repeating group, correct?


Reply to this email directly or view it on GitHubhttps://github.com//issues/3#issuecomment-28020432.

@tmontgomery
Copy link
Contributor

I've confirmed this. A string constant within a repeating group (but not one in a composite) will result in this error during the compile. Will have to refactor the constant storage. For C++99, it is stored in each method. That isn't possible for Java, though.

mjpt777 added a commit that referenced this issue Nov 8, 2013
…tialisation rather than static initialisation to address issue #3.
@mjpt777
Copy link
Contributor

mjpt777 commented Nov 8, 2013

Changed support for constants in repeating groups to use instance initialisation rather than static initialisation. Java does not allow static initialization for inner classes.

@mjpt777 mjpt777 closed this as completed Nov 8, 2013
mjpt777 added a commit that referenced this issue Nov 19, 2013
…tialisation rather than static initialisation to address issue #3.
adam-talos added a commit to adam-talos/simple-binary-encoding that referenced this issue Dec 18, 2022
real-logic#1: LibRsDef explicitly us crate:: to disambiguate from built in mods like bool
real-logic#2: Added acting_version field to Composite structs to fix compilation errors when using Composite structs.  This is an incomplete implementation because the parent doesn't pass the acting_version to the composite because you need to change the signature of wrap(parent, offset) to include the acting_version, so this version just ensures that if the acting_version isn't set on the composite, it disregards the version check.
real-logic#3: fixed primitiveArrayDecoder to return an empty array of the right size if less than version required.
suremarc pushed a commit to polygon-io/simple-binary-encoding that referenced this issue Jan 19, 2023
real-logic#1: LibRsDef explicitly us crate:: to disambiguate from built in mods like bool
real-logic#2: Added acting_version field to Composite structs to fix compilation errors when using Composite structs.  This is an incomplete implementation because the parent doesn't pass the acting_version to the composite because you need to change the signature of wrap(parent, offset) to include the acting_version, so this version just ensures that if the acting_version isn't set on the composite, it disregards the version check.
real-logic#3: fixed primitiveArrayDecoder to return an empty array of the right size if less than version required.
SeanKim pushed a commit to SeanKim/simple-binary-encoding that referenced this issue Feb 21, 2023
real-logic#1: LibRsDef explicitly us crate:: to disambiguate from built in mods like bool
real-logic#2: Added acting_version field to Composite structs to fix compilation errors when using Composite structs.  This is an incomplete implementation because the parent doesn't pass the acting_version to the composite because you need to change the signature of wrap(parent, offset) to include the acting_version, so this version just ensures that if the acting_version isn't set on the composite, it disregards the version check.
real-logic#3: fixed primitiveArrayDecoder to return an empty array of the right size if less than version required.
SeanKim pushed a commit to SeanKim/simple-binary-encoding that referenced this issue Mar 4, 2023
real-logic#1: LibRsDef explicitly us crate:: to disambiguate from built in mods like bool
real-logic#2: Added acting_version field to Composite structs to fix compilation errors when using Composite structs.  This is an incomplete implementation because the parent doesn't pass the acting_version to the composite because you need to change the signature of wrap(parent, offset) to include the acting_version, so this version just ensures that if the acting_version isn't set on the composite, it disregards the version check.
real-logic#3: fixed primitiveArrayDecoder to return an empty array of the right size if less than version required.
mjpt777 pushed a commit that referenced this issue Nov 1, 2023
…ults for enums (#952)

* Fixed several issues:
#1: LibRsDef explicitly us crate:: to disambiguate from built in mods like bool
#2: Added acting_version field to Composite structs to fix compilation errors when using Composite structs.  This is an incomplete implementation because the parent doesn't pass the acting_version to the composite because you need to change the signature of wrap(parent, offset) to include the acting_version, so this version just ensures that if the acting_version isn't set on the composite, it disregards the version check.
#3: fixed primitiveArrayDecoder to return an empty array of the right size if less than version required.

* [Rust] removed 'acting_version' field from SubGroup decoder

* [Rust] updated RustGenerator::generateEnum() to support derive "Default" instead of generating impl

* fixed formatting issue

* [Rust] updated how 'use declarations' are generated to prevent "ambiguous glob re-exports" warnings from rust compiler

---------

Co-authored-by: Adam Krieg <adam@talostrading.com>
Co-authored-by: Michael Ward <mward@drw.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants